关于解决ExpandableListView无ChildItem长按事件的问题
<pre name="code" class="java">expandableListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,int position, long id) {
int npos = expandableListView.pointToPosition((int)view.getX(), (int)view.getY());
if (npos != AdapterView.INVALID_POSITION) {
long pos = expandableListView.getExpandableListPosition(npos);
int childPos = ExpandableListView.getPackedPositionChild(pos);
int groupPos = ExpandableListView.getPackedPositionGroup(pos);
if(childPos == AdapterView.INVALID_POSITION){//group long click
}else{// child long click
}
}
return true;
}
});