Naimul Kabir
Naimul Kabir

Reputation: 444

I want to hide one recycler view where the other one is scrolled

So, I have two scroll view on my screen. First one is horizontal, and the second one is vertical. The first one uses Linear Layout and the second one uses GridLayout. How do I hide the first one with animation, while the second one is scrolling down.

This is the Image

I have tried recyclerview.onScrollListener. But it shows no animation, and the scrolling looks very choppy. I also tried discrollView library, but it also doesn't work in this context.

Please help me. Thanks in advance.

Upvotes: 0

Views: 163

Answers (1)

Amit pandey
Amit pandey

Reputation: 1195

<androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/firstReyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>

                <androidx.recyclerview.widget.RecyclerView
                    android:layout_below="@id/firstReyclerView"
                    android:id="@+id/secondRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
                
            </RelativeLayout>
        </androidx.core.widget.NestedScrollView>

and set secondRecyclerView.setNestedScrollingEnabled(false);

Upvotes: 1

Related Questions