项目中用到listview嵌套listview,虽说不建议使用,但是需求需要,还得使用,直奔主题,目的是点击外部listview的item进行跳转,而内部item只做数据展示不需要点击事件,所以要对内部listview的点击事件做处理,网上一番搜索没有解决问题,在请教一位大神后终于解决,写下记录一下。
需要在外部listview的adapter中的getView方法中设置内部listview的两个属性
listView.setEnabled(false);
listView.setClickable(false);
还需要在外部listview的item的xml文件中给父布局设置
android:descendantFocusability="blocksDescendants"
android:focusable="false"