expandable listview
<ExpandableListView
android:id="@+id/expandable_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:groupIndicator="@drawable/group_indicator"
android:transcriptMode="alwaysScroll" />
setindicator
here iam useing setindicator code like this this working nice
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
mExpandableList.setIndicatorBounds(width - GetPixelFromDips(50), width - GetPixelFromDips(10));
public int GetPixelFromDips(float pixels) {
// Get the screen's density scale
final float scale = getResources().getDisplayMetrics().density;
// Convert the dps to pixels, based on density scale
return (int) (pixels * scale + 0.5f);
}
res/drawable/group_indicator
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">????
<item android:drawable="@drawable/arrow_right" android:state_empty="true"> </item>????
<item android:drawable="@drawable/arrow_down" android:state_expanded="true"></item> ????
<item android:drawable="@drawable/arrow_right"></item>
</selector>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…