答案 0 :(得分:0)
这是ExpandableListView
的原生行为,因此,如果任何项目没有子项,则隐式不会展开,但您需要为组(项目)和子项(选项)设置OnClickListener
:
public boolean onChildClick(ExpandableListView parent, View row,
int groupPosition, int childPosition, long id) {
// callback method after click for Options
return false;
}
public boolean onGroupClick(ExpandableListView parent, View row,
int groupPosition, long id) {
/** if you are using BaseAdapter subclass implementation **/
adapter.getGroup(groupPosition)).getChildren() == null) {
// item doesn't have children
return true;
}
else {
// has children
return false;
}