Android:如何使ExpandableListView中的子行非cklickable?

jel*_*ish 0 java user-interface android expandablelistview

猜猜这很简单,但搜索没有帮助......

我想要一个ExpandableListView,你不能选择子行.

我试图将选择器设置为"透明",但它仍然更改了文本颜色,因此您会注意到您已单击.

亲切的问候,水母

小智 5

如果你来不及,但我希望它对某人有帮助.

您必须在适配器中实现此方法:

public class MyExpandableAdapter extends BaseExpandableListAdapter {
    @Override
    public boolean isChildSelectable(int arg0, int arg1) {
        // Al childs items, If you want some active items have to specify their indices and return true or false
        return false;
    }
    // With all other methods
    ...
}
Run Code Online (Sandbox Code Playgroud)

  • 每个人都在这个页面结束.使用这个答案.有用!! (2认同)