Skip to content

Instantly share code, notes, and snippets.

@wycliffepeart
Created December 4, 2017 12:59
Show Gist options
  • Save wycliffepeart/30b7e69746264df8b127f9c4f1400338 to your computer and use it in GitHub Desktop.
Save wycliffepeart/30b7e69746264df8b127f9c4f1400338 to your computer and use it in GitHub Desktop.
Toolbar Elevation on Pre-lollipop Devices.
<!-- Create a new XML file toolbar.xml in directory res/layouts -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="@drawable/dropshadow" />
</LinearLayout>
<!-- Create a new XML file dropshadow.xml in directory res/drawable -->
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#44000000"
android:angle="90"/>
</shape>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment