Created
July 22, 2015 21:59
-
-
Save brinsche/d84fe9e7f2f0a128ec8a to your computer and use it in GitHub Desktop.
Toolbar shadow in coordinatorlayout pre lollipop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elevation_compat.xml | |
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
<gradient | |
android:angle="270" | |
android:endColor="@android:color/transparent" | |
android:startColor="#50000000" /> | |
</shape> | |
styles.xml | |
<style name="ElevationCompatTheme"> | |
<item name="android:visibility">visible</item> | |
</style> | |
styles.xml for api 21+ | |
<style name="ElevationCompatTheme"> | |
<item name="android:visibility">gone</item> | |
</style> | |
put this at the bottom of your coordinatorlayout to make ot appear on top of other views | |
<View | |
android:layout_width="match_parent" | |
android:layout_height="4dp" | |
android:background="@drawable/elevation_compat" | |
android:theme="@style/ElevationCompatTheme" | |
app:layout_behavior="your scrolling behaviour"/> |
Not working. Needs to be added some addon xml to AppBarLayout that is a Toolbar wrapper:
android:background="@android:drawable/screen_background_light_transparent"
In another case View will contain primaryColor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks