android listviewListview中的button点击事件或者是onitemclick不响应的问题
16lz
2021-01-23
三种方法都可以实现:需要在listview显示内容的布局文件里进行修改才可以起到作用
1.在linearLayout中添加android:descendantFocusability="blocksDescendants"
1.在linearLayout中添加android:descendantFocusability="blocksDescendants"
2.在linearLayout中添加android:descendantFocusability="blocksDescendants" 同时也在button中添加android:focusable="false“都可以实现的
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:descendantFocusability="blocksDescendants"> <CheckBox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false"/> <TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="16dp"/> </LinearLayout>
更多相关文章
- android 界面布局-各个布局的属性介绍
- android view的几种布局方式
- Android基础知识之Manifest文件的组织结构
- Android 五种布局简单介绍
- android中一些配置文件的参数的意义
- Android ImageView控件的setMaxWidth、setMaxHeight不起作用
- Android实现文件上传功能
- android Gradle打包修改生成的apk文件名称
- Android中遍历文件夹、比较文件类型测试