AppCompatActivity remove action bar shadow with style
My app has a minimum sdk of 16 and I am using AppCompatActivity
so I need to use Theme.AppCompat.x
as base theme.
I know that if I call getSupportActionBar().setElevation(0)
, I can remove the shadow below the action bar for each action.
What I want to do is apply this effect using a theme. Any idea to achieve this?
My main style looks like this and the application uses @style/AppTheme
.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary_dark</item>
</style>
+3
source to share
1 answer
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary_dark</item>
<item name="actionBarStyle">@style/MyActionBarStyle</item>
<!-- Pre-lolipop -->
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="MyActionBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- remove shadow below action bar -->
<item name="elevation">0dp</item>
</style>
+4
source to share