android Listview中button 和Listview可同时点击的方法
16lz
2021-01-23
首先我们的Listview如果是自定义的一般会有一个布局文件xxx.xml
在这个xml中第一个元素一般是LinearLayout或RelativeLayout
中加上
android:descendantFocusability="blocksDescendants"
然后其中的ImageButton,或Button我们为其设置
android:clickable="true"
android:focusable="false"
两个属性,就可以实现button和Listview同时点击的效果。
在这个xml中第一个元素一般是LinearLayout或RelativeLayout
中加上
android:descendantFocusability="blocksDescendants"
然后其中的ImageButton,或Button我们为其设置
android:clickable="true"
android:focusable="false"
两个属性,就可以实现button和Listview同时点击的效果。
更多相关文章
- EditText所有属性详解
- ViewGroup之android:animateLayoutChanges属性
- Android layout layout_weight属性理解
- 安卓常用属性
- Android开发入门之学习笔记(四):程序窗口的布局(二)