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;
        }
        });

 

posted on 2014-04-15 16:17  蒜头大葱  阅读(634)  评论(0编辑  收藏  举报

导航