I want to create ExpandableListView with custom group layout which has one RadioButton, one EditText and one Button.
Design Like following:
I created custom layout for group view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp" >
<RadioButton
android:id="@+id/rbGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/etGroup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:ems="10"
android:focusable="false" />
<Button
android:id="@+id/btnEditGroupName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/edit" />
</LinearLayout>
And I used this layout in adapter
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_groups, parent, false);
}
final int ind = groupPosition;
CustomGroup group = (CustomGroup) getGroup(groupPosition);
EditText etGroup = (EditText) convertView.findViewById(R.id.etGroup);
etGroup.setText(group.getName());
((CheckedTextView) convertView).setChecked(isExpanded);
RadioButton rbGroup = (RadioButton) convertView.findViewById(R.id.rbGroup);
rbGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
selectedGroup = ind;
}
}
});
return convertView;
}
But in this case ExpandableListView doesn't expands on click