Android开发:listview 响应问题

1.listview 响应问题
ListView的listitem里面含有Button CheckBox之类的子控件的时候,item不能获取焦点,响应容易出问题。

solution:item布局文件根元素设置属性 android:descendantFocusability="blocksDescendants"

android:descendantFocusability
Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容