Skip to content

Instantly share code, notes, and snippets.

@granoeste
Created June 12, 2017 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save granoeste/6871f47823349cb2122b1a996213793b to your computer and use it in GitHub Desktop.
Save granoeste/6871f47823349cb2122b1a996213793b to your computer and use it in GitHub Desktop.
How to set elevation to RecyclerView?
<RelativeLayout 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:layout_gravity="center"
android:clipToPadding="false"
android:gravity="center"
android:padding="32dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="TITLE............!"
android:textAppearance="@style/TextAppearance.AppCompat.Headline" />
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:name="com.example.elevation.ItemFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button"
android:layout_below="@+id/title"
android:background="@android:color/holo_blue_light"
android:elevation="2dp"
app:layoutManager="LinearLayoutManager"
tools:context="com.example.elevation.ItemFragment"
tools:listitem="@layout/fragment_item" />
<Button
android:id="@+id/button"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Button" />
</RelativeLayout>