更改标高动作条的按主题 [英] Change Elevation of ActionBar by theme

查看:180
本文介绍了更改标高动作条的按主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除的动作条下方的阴影。

I want to remove the shadow below the ActionBar.

我知道我需要改变提升到0dp,但我想这样做的主题。

I know that I need to change the elevation to 0dp, but I want to do it in the theme.

有关Android的4.4-我用:<项目名称=机器人:windowContentOverlay> @空< /项目>

For Android 4.4- I use : <item name="android:windowContentOverlay">@null</item>

但有可能为Android 5.0?

But is it possible for Android 5.0 ?

推荐答案

因此​​,如安东尼奥·何塞,这里有一个答案:<一href="http://stackoverflow.com/questions/12246388/remove-shadow-below-actionbar/27203224#27203224">Remove阴影之下动作条

As shown by Antonio Jose, here is an answer : Remove shadow below actionbar

有关Android的5.0,如果你想直接设置成一个风格的使用:

For Android 5.0, if you want to set it directly into a style use:

<item name="android:elevation">0dp</item>

和用于支持库兼容使用:

and for Support library compatibility use:

<item name="elevation">0dp</item>

风格的AppCompat光的主题例:

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:elevation">0dp</item> -->
<!-- Support library compatibility -->
<item name="elevation">0dp</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>

有关pre的Andr​​oid 5.0也将它添加到您的应用程序的主题:

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>

这篇关于更改标高动作条的按主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆