Copy drawables to /res/drawable/ folder. In my exercise, btn_check_buttonless_on.png and btn_check_buttonless_off.png copied from Android SDK folder: /Android/sdk/platforms/android-20/data/res/drawable-mdpi/
Create /res/drawable/groupindicator.xml, to define our groupIndicator.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_check_buttonless_off"
android:state_expanded="true" />
<item android:drawable="@drawable/btn_check_buttonless_on"/>
</selector>
Modify /res/layout/activity_main.xml to specify android:groupIndicator of ExpandableListView.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.androidexpandablelistview.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold" />
<ExpandableListView
android:id="@+id/mylist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@drawable/groupindicator" />
</LinearLayout>
Next:
- Place groupIndicator of ExpandableListView on right side
No comments:
Post a Comment