解决 ExpandableListView .onChildItemLongClick()

来源:互联网 发布:c语言计算符号函数 编辑:程序博客网 时间:2024/06/06 10:51

关于解决ExpandableListView无ChildItem长按事件的问题

<pre name="code" class="java">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;}    });


0 0
原创粉丝点击