0

I have bellow layout :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:clickable="true">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/signsRecycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

</RelativeLayout>

And bellow layout is items of above recyclerView, in this layout I have another recyclerView. How can I scroll this recyclerView ?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/cardVisibleLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardElevation="2dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="horizontal">

            <com.joanzapata.iconify.widget.IconTextView
                android:id="@+id/itxtArrow"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@null"
                android:gravity="center"
                android:text="@string/fa_chevron_down"
                android:textColor="@color/orangePeel" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="right"
                android:layout_weight="5"
                android:gravity="right"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/txtCategoryName"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="right"
                    android:layout_marginRight="15dp"
                    android:layout_weight="5"
                    android:gravity="center_vertical" />
            </RelativeLayout>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cardVisibleLayout">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rcyNested"
            android:layout_width="match_parent"
            android:layout_height="125dp" />
    </LinearLayout>

</RelativeLayout>

1 Answers1

0

Resolved my problem with bellow code :

    viewHolder.rcyNested.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
  • 1
    Also test this solution in old versions. If scroll is not working in old devices. Please add this line in your parent recyclerView adapter:- ViewCompat.setNestedScrollingEnabled(holder.recyclerView_Child, false); – Däñish Shärmà Apr 11 '18 at 13:36
  • @ Däñish Shärmà.Thank's a lot. –  Apr 11 '18 at 13:44