I\'m trying to implement a layout which contains RecyclerView and ScrollView at the same layout.
Layout template:
Try this. Very late answer. But surely help anyone in future.
Set your Scrollview to NestedScrollView
<android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.RecyclerView>
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
In your Recyclerview
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setHasFixedSize(false);
Another approach to address the issue is to use ConstraintLayout
inside ScrollView
:
<ScrollView>
<ConstraintLayout> (this is the only child of ScrollView)
<...Some Views...>
<RecyclerView> (layout_height=wrap_content)
<...Some Other Views...>
But I would still stick to the androidx.core.widget.NestedScrollView
approach, proposed by Yang Peiyong.