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;
            }return false;
        }
        });
原文地址:https://www.cnblogs.com/suizi/p/3666539.html