Android ExpandableListView OnChildClickListener不起作用

Ali*_*jad 1 android android-layout

我有一个ExpandableListView,一切都很好.当我点击子行时,我想在每个子行中有一个复选框,如下所示:

expandableListView.setOnChildClickListener(new OnChildClickListener() {
    @Override
    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
        CheckBox checkBox = (CheckBox) v.findViewById(R.id.checkBox1);
        checkBox.toggle();
        return true;
    }
});
Run Code Online (Sandbox Code Playgroud)

问题是程序永远不会进入onChildClick()事件处理程序.任何的想法?

And*_*lva 5

试试这个,

设置android:focusable=false复选框.如果它仍然无法工作,那么添加,

android:descendantFocussability=blocksDescendants 到最顶层的布局.