Change opacity/intensity of view elevations in Android

If you want your card elevation to be lighter or darker, add these two attributes to your app base style theme in styles.xml.

Note: The value ranges from 0 to 1, 0 being transparent and 1 being completely opaque/black.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:ambientShadowAlpha">0.09</item> 
    <item name="android:spotShadowAlpha">0.09</item>
    <!--your other styles here-->

Also published on Medium.

By |2019-04-05T09:41:44+00:00March 14th, 2019|Categories: Android Tips|0 Comments

Leave A Comment