转自 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事件,这样大家谁都不惹谁,和平相处.

更多相关文章

  1. Android开发技术文章整理
  2. Android自定义对话框的使用
  3. Android(安卓)CalendarView 使用
  4. Android自定义对话框的使用
  5. Alert Dialog
  6. selector
  7. Android快速入门
  8. Android自定义对话框的使用
  9. Android(安卓)Shareperferences使用

随机推荐

  1. html元素第一课
  2. 3.19作业下拉框
  3. Spring Boot + Vue3 前后端分离实战wiki
  4. 作业20210321
  5. C++中的const
  6. Spring Cloud 2.x之Activiti整合规则引擎
  7. 谷歌重返中国最受伤的是谁?
  8. 2021-03-21:给定一棵二叉树的头节点head,求
  9. 互联网大佬纷纷搞养殖,这是为哪般~~~
  10. 阻塞 非阻塞 进程等待 wait waitpid