可扩展列表视图不选择行

时间:2015-01-27 12:32:08

标签: android listview android-listview

我检查了文档&尝试了几种方法来禁用可扩展列表视图的组项目的单击。没有人使用。

Expandablelistadapter中有一种方法isChildSelectable。但不是GroupSelectable。我尝试了很多,比如禁用点击列表项等等。没有运气。我想禁用某些listview组项目的点击。

1 个答案:

答案 0 :(得分:2)

 expandableList.setOnGroupClickListener(new OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent,
                    View childView, int groupPosition, long id) {
                if (groupPosition == desirePosition) {// give your condition here
//temporary condition is given
                    return true; // the expander cannot be collapsed
                }
                return false;
            }
        });
相关问题