I would like to change the default behaviour of the expandable list view from:
short click => expand / collapse
to:
开发者_如何学Pythonlong click => expand / collapse
short click => select item or child
OK, it seems the best solution is to do this with a list item click / long click listener.
public void onClick(View view)
{
// click - do something with item
}
public boolean onLongClick(View view)
{
// group position was stored in view tag
int groupPosition = (Integer) view.getTag();
ExpandableListView listView = (ExpandableListView) findViewById(R.id.expandableListView);
if (listView.isGroupExpanded(groupPosition))
listView.collapseGroup(groupPosition);
else
listView.expandGroup(groupPosition);
return true;
}
精彩评论