ExpandListView 如何增加子项的onLongClick事件
其实很简单
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int groupPosition = ExpandableListView.getPackedPositionGroup(id);
int childPosition = ExpandableListView.getPackedPositionChild(id);
return true;
}
return false;
}
这个时候 groupPosition就是父类位置,childPosition就是子类位置