ListView点击效果设置
16lz
2021-01-23
android:focusable= “true”
android:focusableInTouchMode= “true”
以上两个属性一起使用有些特别的地方,比如设置
ItemView的android:focusable=”true”
android:focusableInTouchMode=”true”
可以使ItemView在Touch mode 下获取焦点,默认情况下,Touch mode下ItemView,menu等等控件 都是不能获取焦点的。只有ListView获取了焦点之后,ItemView才能获取焦点。
android:descendantFocusability
属性的值有三种:
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
更多相关文章
- Android常用控件—TextView及其子类Button、EditText等
- android ImageView 控件
- Android控件开发之TextView
- android中textview控件中的文字的位置是如何调整的
- Android中设置控件可见与不可见详解
- Android下拉框控件Spinner的使用
- android之控件EditText学习
- Android TV 焦点控制逻辑
- Android 线性布局(LinearLayout)内各控件如何设置间距