I want to add an image icon in expandable list view .I have seen the tutorial they have added only in child elements .Is there any other way to add image icon in parent Any help would be appreciated. Thanks in advance.
android.widget.ExpandableListView. A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children. The items come from the ExpandableListAdapter associated with this view.
Android ExpandableListView is a view that shows items in a vertically scrolling two-level list. It differs from a ListView by allowing two levels which are groups that can be easily expanded and collapsed by touching to view and their respective children items.
You can also define your own groupIndicator in XML:
First define your own drawable (I called it list_view_group_indicator.xml and placed it in the drawable directory)
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_expanded="true"
android:drawable="@drawable/packagexgeneric" />
<item
android:drawable="@drawable/packagexgenericclose" />
</selector>
Then use it as a drawable for your expandableListview
<ExpandableListView android:id="@+id/server_show_list"
android:layout_width="fill_parent"android:layout_height="wrap_content"
android:groupIndicator="@drawable/list_view_group_indicator" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With