I've been debugging this for hours, and of course I find the solution 3
minutes after I post to the list.
The CheckBox should android:focusable="false" as well...
Regards,
Sebastiaan
sebster wrote:
> Hi,
>
> I'm trying to implement an expandable list view where the group view
> contains a label and a checkbox, visually represented below (the v and
>
>> are the expand/collapse icons, the [x]/[ ] a checked/unchecked
>>
> checkbox):
>
> v group 1 [x]
> child 1
> child 2
>
>> group 2 [ ]
>> group 3 [x]
>>
>
> I extended BaseExpandableListAdapter to inflate and return a group
> view:
>
> public View getGroupView(int groupPosition, boolean isExpanded, View
> convertView, ViewGroup parent) {
> View groupView = convertView;
> if (groupView == null) {
> groupView =
> LayoutInflater.from(context).inflate(R.layout.group,
> null);
> }
> return groupView;
> }
>
> with the following layout:
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <LinearLayout android:id="@+id/groupView"
> android:layout_width="fill_parent" android:layout_height="?
> android:attr/listPreferredItemHeight"
> android:orientation="horizontal" android:gravity="center_vertical"
> xmlns:android="http://schemas.android.com/apk/res/android">
>
> <TextView android:text="label" android:id="@+id/groupLabel"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:textAppearance="?android:attr/textAppearanceLarge"
> android:layout_weight="1"
> android:paddingLeft="?android:attr/
> expandableListPreferredItemPaddingLeft"></TextView>
>
> <CheckBox android:id="@+id/groupEnabled"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:focusableInTouchMode="false"></CheckBox>
>
> </LinearLayout>
>
> Now the strange thing is, when I touch the group it no longer expands
> or collapses. As soon as I uncomment the checkbox above, it does
> expand/collapse when I touch the group.
>
> Does anybody know what's going on, and how to get it to expand/
> collapse even though the checkbox is in there?
>
> Regards,
> Sebastiaan
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---