Android ExpandableListView长按事件
expandableListView.setOnItemLongClickListener(new
OnItemLongClickListener(){
@Override
public boolean
onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long
arg3) {
// TODO
Auto-generated method stub
if(ExpandableListView.getPackedPositionType(arg3)==ExpandableListView.PACKED_POSITION_TYPE_CHILD){
long packPos =
((ExpandableListView) arg0).getExpandableListPosition(arg2);
int
groupPosition=ExpandableListView.getPackedPositionGroup(packPos);
int
childPosition=
ExpandableListView.getPackedPositionChild(packPos);
System.out.println("------------------------------->"+groupPosition);
System.out.println("--------------------------------------->"+childPosition);
return
true;
}else
if(ExpandableListView.getPackedPositionType(arg3)==ExpandableListView.PACKED_POSITION_TYPE_GROUP){
long packPos =
((ExpandableListView)arg0).getExpandableListPosition(arg2);
int
groupPosition=ExpandableListView.getPackedPositionGroup(packPos);
int
childPosition=
ExpandableListView.getPackedPositionChild(packPos);
System.out.println("-------------------++++++++++++++------------>"+groupPosition);
System.out.println("-----------------------++++++++++++++---------------->"+childPosition);
}
return false;
}
});
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。