please help!
I'm trying to create a layout where I have a LinearLayout containing an ImageView and a TextView alongside a horizontal RecyclerView. I want both the LinearLayout and the RecyclerView to behave as a single horizontally scrollable unit. When I scroll the RecyclerView, the LinearLayout should scroll with it, as if it's the first item of the RecyclerView.
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<!-- LinearLayout with ImageView and TextView -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- ... ImageView and TextView ... -->
</LinearLayout>
<!-- RecyclerView -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="horizontal" />
</LinearLayout>
In my Java code, I've set setNestedScrollingEnabled(false) for the RecyclerView, but it's not working as expected. The RecyclerView and the LinearLayout are not scrolling together.
I've also tried using a HorizontalScrollView, but the RecyclerView scrolls separately from the LinearLayout.
Can someone help me achieve the desired behavior where both the LinearLayout and the RecyclerView scroll together horizontally, as if they are a single unit?
Any guidance or code examples would be greatly appreciated!