[转载]listView当中有嵌套了有onClickListener的控件时ListView自身的onItemClick无响应的解决方案 - petercao - 博客园

baacloud免费翻墙vpn注册使用

[转载]listView当中有嵌套了有onClickListener的控件时ListView自身的onItemClick无响应的解决方案 – petercao – 博客园.

Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.

Must be one of the following constant values.

Constant Value Description
beforeDescendants 0 The ViewGroup will get focus before any of its descendants.
afterDescendants 1 The ViewGroup will get focus only if none of its descendants want it.
blocksDescendants 2 The ViewGroup will block its descendants from receiving focus.

解决方案

在ListView要显示的Item的外层加上

android:descendantFocusability="blocksDescendants"

这段代码

<!--?xml version="1.0" encoding="utf-8"?-->

&nbsp;

&nbsp;
赞(0) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏