Skip to content

Instantly share code, notes, and snippets.

@jflavio11
Forked from kamikat/layout.xml
Created June 10, 2019 21:26
Show Gist options
  • Save jflavio11/07eb9ccd3be3474b66b6a3c677b9570f to your computer and use it in GitHub Desktop.
Save jflavio11/07eb9ccd3be3474b66b6a3c677b9570f to your computer and use it in GitHub Desktop.
NestedScrollView + SwipeRefreshLayout + RecyclerView
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:focusableInTouchMode="true"> <!-- Prevents scrolling location from being overriden by RecyclerView -->
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:gravity="center"
android:text="Contents above RV"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment