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;
}
});
解决 ExpandableListView .onChildItemLongClick()
最新推荐文章于 2021-05-26 20:02:25 发布