Android(安卓)listview中使用button解决方法
16lz
2021-12-04
转自 http://blog.csdn.net/elinavampire/article/details/42869015
android:descendantFocusability有三个值,分别是:beforeDescendants,afterDescendants,blocksDescendants
1.android:descendantFocusability="beforeDescendants"这句的意思就是说listview的item先拿到焦点
2.android:descendantFocusability="afterDescendants"只有button不需要焦点时item才能拿到焦点
3.android:descendantFocusability="blocksDescendants"item覆盖button直接拿到焦点
看到这三条属性的作用你应该知道怎么解决了吧,listview和button出现抢焦点时我一般使用使用第三条,然后在adapter写button的onclick事件,这样大家谁都不惹谁,和平相处.
更多相关文章
- Android开发技术文章整理
- Android自定义对话框的使用
- Android(安卓)CalendarView 使用
- Android自定义对话框的使用
- Alert Dialog
- selector
- Android快速入门
- Android自定义对话框的使用
- Android(安卓)Shareperferences使用