listView当中有嵌套了有onClickListener的控件时ListView自身的onItemClick无响应的解决方案

Ref:http://www.cnblogs.com/bluestorm/archive/2013/03/24/2979557.html

 

android:descendantFocusability

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.

ConstantValueDescription
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"

posted @ 2016-09-14 17:03  鲸歌  阅读(143)  评论(0编辑  收藏  举报