Reputation: 11141
I want to set new style for expandable list view in my Android app. I am creating a group_indicator.xml file in drawable folder, where I am writing the code:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_empty="true" android:drawable="@drawable/arrowright1">
<item android:state_expanded="true" android:drawable="@drawable/arrowdown1">
<item android:drawable="@drawable/arrowright1">
</item></item></item></selector>
Then I am using this XML file in my ExpandableList
view in the main file:
<ExpandableListView
android:id="@+id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:groupIndicator="@drawable/group_indicator"
android:layout_weight="1" >
</ExpandableListView>
Now I want to set some more styles for my expandable list, I want to change the appearance of the parent and the child nodes.
Is there any other way to do that?
I heard of some style.xml file in res->values
folder, but I don't know exactly how to implement it.
Please Guide.
Upvotes: 1
Views: 2581
Reputation: 7708
You need to use implement custom ExpandableListAdapter
Override the following methods:
getChildView to override child view and inflate your own custom view. getGroupView to override group header view and inflate your own custom view.
Upvotes: 3
Reputation: 25830
Use the ExpandableListView#setGroupIndicator(Drawable) method. it worked for me. hope it wil help you.
Upvotes: 0