i have a recycler view which contains a lot of posts. while i scroll the recyclerview my frame layout doesn't scroll. it is fixed like a navigation bar. I want it to scroll as if it was part of the recyclerview. Here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:background="#ffffff"
tools:context=".HomePageFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/status_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"></FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</ScrollView>
i tried using nestedScrollView but it adds extra empty posts. I dont know why.
My frameLayout is the status part. which is another recyclerview itself.while scrolling the posts the statuspart doesn't scroll.
In order for status part to scroll with posts in the recyclerview, status part should also be an item in the recyclerview, so you need recyclerview with multiple view types
for this case. Plase read: How to create recyclerview with multiple view types.
Just remove the Framelayout
it's not necessary, when using recyclerviews with multiple view types.
Minor improvements
Remove the outer scrollview
its unnecessary, since recyclerview by default is scrollable.
Edit:
In order for status part to be scrollable horizontally, status part item layout should contain a recyclerview
where LinearLayoutManager orientation set to horizontal. Remember to implement the adapter class for the horizontal recyclerview also.
For you to get started with recyclerview with multiple view types, you may look at this tutorial.
You may also use library like Epoxy in this case.