Android Listview嵌套Listview焦点问题

sadcui 2017-05-16 09:43:10
如题,如何使子listview无法点击,或者点击子listview 也是响应父listview的item点击事件。
...全文
176 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sadcui 2017-05-16
  • 打赏
  • 举报
回复
找到了答案[http://www.fx114.net/qa-218-207783.aspx 一、在父listview的适配器布局中加上 android:descendantFocusability="blocksDescendants" 使得获取焦点 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/layout_border" android:descendantFocusability="blocksDescendants" android:orientation="vertical" android:paddingTop="15dp" > 二、取消子ListView控件的焦点 listview.setFocusable(false);listview.setClickable(false);但是设置到了这里还是没有效果,然后我干脆把子ListView所有的事件和焦点都屏蔽掉,添加代码: listview.setPressed(false);listview.setEnabled(false);

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧