Reputation: 1068
Is it possible to put more than one TextView in the items of a ExpandableListView? I've tried this, and not working, the second TV is not shown:
group_item.xml
<TextView android:id="@+id/row_name"
android:paddingLeft="5dp"
android:textSize="18dp"
android:textColor="@color/black"
android:textStyle="normal"
android:layout_width="320dp"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/row_desc"
android:text="Some text here"
android:paddingLeft="5dp"
android:textSize="18dp"
android:textColor="@color/black"
android:textStyle="normal"
android:layout_width="320dp"
android:layout_height="wrap_content"/>
Upvotes: 0
Views: 2109
Reputation: 1427
Yes it is possible an example for you I added to github.
I am working on frozen columns exp in this project. ignore them. In the adapter you will see multiple columns
https://github.com/huseyinDaVinci/Android/tree/master/ExpandableListView
Upvotes: 0
Reputation: 16393
You haven't said what's backing your listview, so I'll show an example with cursors (assuming a SimpleCursorTreeAdapter).
mAdapter = new MyExpandableListAdapter(
mGroupsCursor, // cursor supplying group data
getActivity(), // context
R.layout.group_item, // Group row layout
R.layout.child_item, // Child row layout
new String[] { "column1", "column2" }, // Cursor columns from group cursorto be mapped to group view
new int[] { R.id.row_name, R.id.row_desc }, // View ids to receive group column data
new String[] { "child1", "child2"}, // Cursor columns from child cursor to be mapped to child view
new int[] { R.id.child1, R.id.child2 // View ids to receive child column data
});
lv.setAdapter(mAdapter); // Set your adapter
Upvotes: 1
Reputation: 76
Yes it is possible. But you will have to do your own binding. Therefor make a custom adapter and overwrite the bindGroupView or bindChildView method.
-edit-
I'm sorry, I was a bit confused with the question. If all you want to do is fill two textviews then you do not have to overwrite the bindgroupview or bindchildview methods. That's only if you need to do more complex binding.
Upvotes: 0