android listview 中加 button、imagebutton等之后失去点击效果的解决办法

问题在于listview的每一项加了按钮、图片等,会使得focus被按钮、图片等抢占,导致listview的每个item点击没了效果。解决办法就是:

在xml的根节点添加属性:android:descendantFocusability="blocksDescendants"

再在button之类控件上添加属性:android:focusable="false"

虽然不是特别理解,但是模糊的以为是:每个button设置熟悉不获得焦点,根节点设置焦点的传递性能。

 

posted @ 2013-06-25 20:31  小猴偷米  Views(628)  Comments(0Edit  收藏  举报