listview和checkbox点击事件冲突解决

来源:互联网 发布:如何正确对待人工智能 编辑:程序博客网 时间:2024/04/28 06:37
在itemlist里面的父布局加上:
 android:descendantFocusability="blocksDescendants"(listview和checkbox事件都可以响应)
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginBottom="@dimen/y23"    android:layout_marginLeft="@dimen/x23"    android:layout_marginRight="@dimen/x23"    android:layout_marginTop="@dimen/y23"    android:background="@mipmap/list_paijian_yiwancheng_chang"    android:descendantFocusability="blocksDescendants"    android:gravity="center_vertical"    android:orientation="horizontal">    <TextView        android:id="@+id/cap_position"        style="@style/text_28_white"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginLeft="@dimen/x68"        android:text="1" />    <android.support.constraint.ConstraintLayout        android:id="@+id/cl_click_list_entity"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginLeft="@dimen/x114">        <TextView            android:id="@+id/cpa_waybill"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="@string/task"            android:textColor="#aaffffff"            app:layout_constraintLeft_toLeftOf="parent"            app:layout_constraintTop_toTopOf="parent" />        <TextView            android:id="@+id/cpa_waybill_value"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="@dimen/x23"            android:text="0816196731-193855"            app:layout_constraintLeft_toRightOf="@+id/cpa_waybill"            app:layout_constraintTop_toTopOf="parent" />        <TextView            android:id="@+id/cpa_weight"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginTop="@dimen/y12"            android:text="@string/department"            android:textColor="#aaffffff"            app:layout_constraintLeft_toLeftOf="parent"            app:layout_constraintTop_toBottomOf="@+id/cpa_waybill" />        <TextView            android:id="@+id/cpa_weight_value"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="@dimen/x23"            android:layout_marginTop="@dimen/y12"            android:text="@string/fake_business_depart"            app:layout_constraintLeft_toRightOf="@+id/cpa_weight"            app:layout_constraintTop_toBottomOf="@+id/cpa_waybill" />        <TextView            android:id="@+id/cpa_volume"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginTop="@dimen/y12"            android:text="@string/active"            android:textColor="#aaffffff"            app:layout_constraintLeft_toLeftOf="parent"            app:layout_constraintTop_toBottomOf="@+id/cpa_weight" />        <TextView            android:id="@+id/cpa_volume_value"            style="@style/text_28_white"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="@dimen/x23"            android:layout_marginTop="@dimen/y12"            android:text="@string/fake_votes"            app:layout_constraintLeft_toRightOf="@+id/cpa_volume"            app:layout_constraintTop_toBottomOf="@+id/cpa_weight_value" />        <CheckBox            android:id="@+id/is_check"            android:layout_width="@dimen/x69"            android:layout_height="@dimen/y69"            android:layout_marginBottom="8dp"            android:layout_marginLeft="8dp"            android:layout_marginRight="@dimen/x75"            android:layout_marginTop="8dp"            android:background="@drawable/select_radio_bg"            android:button="@null"            app:layout_constraintBottom_toBottomOf="parent"            app:layout_constraintLeft_toRightOf="@id/cpa_weight_value"            app:layout_constraintRight_toRightOf="parent"            app:layout_constraintTop_toTopOf="parent"            app:layout_constraintVertical_bias="0.529" />    </android.support.constraint.ConstraintLayout></LinearLayout>
阅读全文
0 0
原创粉丝点击