Saturday, August 28, 2010

[android-developers] Layout question

Hi,
I would like to create a layout that would have a Checkbox, then a
divider, then a listview with single choice mode.

I tried this


<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<CheckBox android:id="@+id/CheckBox01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:clickable="true"
android:text="Chains"></CheckBox>

<View android:id="@+id/divider" android:background="@drawable/
black_white_gradient" android:layout_width="fill_parent"
android:layout_height="1dp" />

<ListView android:id="@+id/ListView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>

</LinearLayout>

with this


lView = (ListView) findViewById(R.id.ListView01);
//lView = (ListView) findViewById(R.id.list);
// Set option as Multiple Choice. So that user can able to select
more the one option from list
lView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice, lv_items));
lView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

lView.setItemChecked(0, true);


but it didn't work.
I can't seem to get a checkbox on top of a listview properly. I also
would like for the words to be to the left of the checkbox. Any help
on this would be much appreciated!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate