Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created March 9, 2019 21:00
Show Gist options
  • Save NezSpencer/eeb8489e3c2ab1de7f4e27c3429f070a to your computer and use it in GitHub Desktop.
Save NezSpencer/eeb8489e3c2ab1de7f4e27c3429f070a to your computer and use it in GitHub Desktop.
recycler view with other views in a scrollView
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ScrollView android:layout_width="match_parent"
android:fillViewport="true"
android:padding="16dp"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="@+id/iv_image"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:src="@drawable/kid"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:contentDescription="Hello World!"
/>
<TextView
android:id="@+id/tv_image_name"
android:textSize="16sp"
android:text="Image Name: Pencil"
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tv_image_desc"
android:textSize="16sp"
android:layout_marginTop="16dp"
android:text="Image Description: Pencil description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_marginTop="16dp"
android:orientation="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_footer_image"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:src="@drawable/hare"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:contentDescription="Hello World!"
/>
<TextView
android:id="@+id/tv_footer_text"
android:text="This is a footer"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment