mercredi 1 novembre 2017

CheckBox in RecyclerView not working when pressed

I have basic RecyclerView item with TextView and CheckBox. But when I click CheckBox, it does not work. All the more amazing it works when I long pressed.

I made a research and found android:descendantFocusability="blocksDescendants" , android:clickable="false", android:focusable="false" , android:longClickable="false" but they didn't help me

Here is my RecyclerView Item layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:app="http://ift.tt/GEGVYd"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants">

    <TextView
        android:id="@+id/item_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="TextView"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:textColor="#000000"/>

    <android.support.v7.widget.AppCompatCheckBox
        android:id="@+id/item_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:layout_marginEnd="10dp"
        app:buttonTint="@color/colorAccent"
        android:focusable="false"
        android:focusableInTouchMode="false"/>

</LinearLayout>




Aucun commentaire:

Enregistrer un commentaire