Getting a Fully-Expanded RecyclerView to Scroll With Other Content On the Page

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="36sp"
android:background="@color/headerBackground"
android:text="@string/headerText" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/goals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
</LinearLayout>

</ScrollView>
You can see that you scroll down and the light-blue “arch” at the bottom indicates we’re at the bottom of the list, even though there are actually 20 items in the list. The RecyclerView’s contents got cut off.
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="36sp"
android:background="@color/headerBackground"
android:text="@string/headerText" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/goals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>
</LinearLayout>

</androidx.core.widget.NestedScrollView>

--

--

--

Documenting my learnings on my journey as a software engineer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

MVVM Android development (java)

How to Create a Multi-Pane Drawer in React Native

Media Streaming libraries tested and used in Ramudroid

Understanding the Constraint Layout in Android

Hands on with Jetpack’s Security App Authenticator library

HMS ML Kit — Live Image Classification

Unpacking Android Security: Part 1 — Improper Platform Usage

Android Never Ending Service With Xamarin.Forms

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Brian Terczynski

Brian Terczynski

Documenting my learnings on my journey as a software engineer.

More from Medium

How to register keyboard shortcuts in Android’s menu to inform users

RazorPay — Android Integration

Quest to a refined Outdoor Experience Android App (Strava and Relive inspired) — Part 4

How to Observe Network Connection Status