0

In my android project i am using nested recyclerview when i click on item the click is not working.I think it is focusing on the second.

What i tried is

  1. Disabled the 2nd recyclerview
  2. Made it not clickable
  3. Made it not focusable

My xml code is

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_action_search"
        android:elevation="1dp"
        android:layout_marginBottom="@dimen/half_padding"
        android:layout_marginTop="@dimen/half_padding"
        android:layout_marginHorizontal="@dimen/single_padding"
        android:id="@+id/layout_CAS"
        android:minHeight="66dp"
       >


        <androidx.appcompat.widget.AppCompatTextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="@dimen/double_padding"
            android:textColor="@color/black"
            android:text="Don't check the Enable new Logcat tool window at the end."
            android:fontFamily="@font/polly_rounded_bold"
            android:textSize="12sp"
            android:id="@+id/head_CAS"
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginTop="@dimen/single_padding"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toStartOf="@id/tick_CAS"
            />
        
        <androidx.appcompat.widget.AppCompatImageView
            android:layout_width="24dp"
            android:layout_height="24dp"
            app:layout_constraintTop_toTopOf="@id/head_CAS"
            app:layout_constraintEnd_toEndOf="parent"
            android:id="@+id/tick_CAS"
            android:src="@drawable/ic_action_tick"
            android:layout_marginEnd="@dimen/single_padding"
            />


        <androidx.recyclerview.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toBottomOf="@id/head_CAS"
            android:layout_marginTop="@dimen/single_padding"
            android:layout_marginHorizontal="@dimen/double_padding"
            android:id="@+id/actionTypeRV_FPAA"
            />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>

What my references are

Nested RecyclerView onClickListener not working Nested RecyclerView onClick not triggered How to implement onClick listener on nested recyclerview clicklistener not working in recyclerview

Rahul R
  • 11
  • 2
  • Where are you using "Nested RV" Can you share your java code corresponding to the XML? – Rahul Shukla Jul 19 '23 at 12:45
  • it is tricky to use nested recycler view if your child recyclerview is already opened then you're in trouble mate. a work around for this is to have a button in parent recyclerview and when parent rv item is clicked save its reference somewhere if you need nested data manipulation. then you have to use interface to pass the reference or anything when child rv is clicked if any data manipulation is required – Ghazanfar Ateeb Jul 20 '23 at 06:12

0 Answers0