For Android 5.0, if you want to set it directly into a style use:
item name=android:elevation0dp/item
and for Support library compatibility use:
item name=elevation0dp/item
Example of style for a AppCompat light theme:
style name=Theme.MyApp.ActionBar parent=style/Widget.AppCompat.Light.ActionBar.Solid.Inverse
!-- remove shadow below action bar --
!-- item name=android:elevation0dp/item --
!-- Support library compatibility --
item name=elevation0dp/item
/style
Then apply this custom ActionBar style to you app theme:
style name=Theme.MyApp parent=Theme.AppCompat.Light
item name=actionBarStyle@style/Theme.MyApp.ActionBar/item
/style
For pre 5.0 Android, add this too to your app theme:
!-- Remove shadow below action bar Android 5.0 --
item name=android:windowContentOverlay@null/item
取消
评论
本文介绍了如何在Android 5.0及更高版本以及支持库中去除Action Bar下方的阴影。对于Android 5.0及以上,可以在样式中设置`android:elevation=0dp`;对于支持库兼容性,同样设置`elevation=0dp`。给出了适用于AppCompat Light主题的示例,并展示了如何将自定义ActionBar样式应用到应用程序主题。对于Android 5.0之前的版本,还需在主题中添加`android:windowContentOverlay=@null`来移除阴影。
1146

被折叠的 条评论
为什么被折叠?



