I have an expandable list view, where the child view is a custom layout consisting of 2 text views within a RelativeLayout as follows: <RelativeLayout .....> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="?android:attr/ expandableListPreferredItemPaddingLeft" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center_vertical" /> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text2" android:layout_height="fill_parent" android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:numeric="integer" android:text="@string/text2"/> </RelativeLayout>
However, when I click on the child view the onChildClick() is not getting called. If I remove the second text view text2 above, then it works fine and onChildClick() is called. Can anyone help me identify the problem here? This is the outline of my code: ExpandableListView list = (ExpandableListView) findViewById (R.id.expandableListView); list.setVisibility(View.VISIBLE); Cursor groupCursor = managedQuery(Category.CONTENT_URI, null, null, null, Items.DEFAULT_SORT_ORDER); // Set up our adapter mAdapter = new ShoppingListAdapter(groupCursor, ShoppingListActivity.this, R.layout.categories_list,// android.R.layout.simple_expandable_list_item_1, R.layout.items_list,// android.R.layout.simple_expandable_list_item_1, //android.R.layout.simple_list_item_multiple_choice, new String[] {Category.NAME}, // Name for group layouts new int[] {android.R.id.text1}, new String[] {Items.NAME}, // Number for child layouts new int[] {android.R.id.text1}); list.setAdapter(mAdapter); list.setOnChildClickListener(new OnChildClickListener(){ public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // TODO Auto-generated method stub showEditQuantityDialog(); return true; } }); } public class ShoppingListAdapter extends SimpleCursorTreeAdapter{ private String mItemsProjection[] = new String[] { Items._ID, Items.NAME }; private static final String ITEMS_SELECTION = Items.CATEGORY_ID + "=?"; public ShoppingListAdapter(Cursor cursor, Context context, int groupLayout, int childLayout, String[] groupFrom, int[] groupTo, String[] childrenFrom, int[] childrenTo) { super(context, cursor, groupLayout, groupFrom, groupTo, childLayout, childrenFrom, childrenTo); } @Override protected Cursor getChildrenCursor(Cursor groupCursor) { // Given the group, we return a cursor for all the children within that group Long groupId = groupCursor.getLong (groupCursor.getColumnIndexOrThrow(Category._ID)); String strGroupId = Long.toString(groupId); String[] selectionArgs = new String[] { strGroupId }; // The returned Cursor MUST be managed by us, so we use Activity's helper // functionality to manage it for us. return managedQuery(Items.CONTENT_URI, mItemsProjection, ITEMS_SELECTION, selectionArgs, Items.DEFAULT_SORT_ORDER); } } -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en