I am trying to place a recyclerview inside a nested scroll view. Following is my layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/nestedscrollview">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.nestedscrollviewexample.ItemFragment"
android:layout_marginTop="84dp"
android:id="@+id/itemfragment"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</FrameLayout>
The fragment contains a simple Recylerview.
What i notice is that if the recyclerview is outside the NestedScrollView then it retains it edge effects. However when i place the recycler view inside the nestedscrollview the edge effects are gone.
Instead, when i add the following line-
ViewCompat.setNestedScrollingEnabled(recyclerView, false);
I notice that edge effects are visible but only for the edge of nested scrollview. How can i retain the edge effect for the recycler view as well?
For better clarity i am sharing 2 images -
First is Recyclerview edge effect before adding it to nested scroll view. [
]
The one below is when we add recycler view to a nested scroll view-
I would like to have the recyclerview inside the nested scrollview and also keep its edge effects. Is it possible?