2019独角兽企业重金招聘Python工程师标准>>>
/**
在每个itemView中都包含其他的组件,特别是button,button和listView的共存问题在这里也是不可避免的需要解决,
方法比较简单,即: 在item的布局文件中的顶层Layout添加属性:
android:descendantFocusability="blocksDescendants"
这个是设置该layout下面的子view无法获取focus,
我记得在测试的时候这设置就可以了,
但是网上很多说法都是在button属性里也要设置如下属性:
android:focusable="false"
**/
class ExpandableAdapter extends BaseExpandableListAdapter { .......... @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; //这里默认返回false,我们需要改成 true }
}