android - ExpandableListView - A checkbox as indicator for expanded or not -
this have, expandable listview. each group item checkbox witha textview next it.
i want checkbox toggled checked/unchecked if group expanded or not expanded.
also vica versa, if checkbox checked, list should expanded etc.
any ideas?
this group_layout.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <checkbox android:id="@+id/check_channel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:focusable="false" android:layout_gravity="left" android:checked="false" /> <textview android:textsize="20sp" android:textisselectable="false" android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="20dp" android:layout_marginleft="55dp"/> </relativelayout>
it looks pretty, need check , uncheck .
ah ok, how did it
public view getgroupview(int groupposition, boolean isexpanded, view convertview,viewgroup parent) { view v; if (convertview == null) { v = newgroupview(isexpanded, parent); } else { v = convertview; } if ( isexpanded ) { ((checkbox) v.findviewbyid(r.id.check_channel)).setchecked(true); } else { ((checkbox) v.findviewbyid(r.id.check_channel)).setchecked(false); } bindgroupview(groupposition, isexpanded, v, parent); return v; }
Comments
Post a Comment