删除操作栏下方的阴影 [英] Remove shadow below actionbar

查看:31
本文介绍了删除操作栏下方的阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 actionbarsherlock.下面这段代码负责将其背景更改为自定义背景.

I use actionbarsherlock. The piece of code below is responsible for changing it's background to a custom one.

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="background">@drawable/actionbar_bg</item>
    <item name="android:background">@drawable/actionbar_bg</item>
    <...>  
</style>

<style name="Theme.MyApp" parent="@style/Theme.Sherlock.Light">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <..>
</style>

它适用于 actionbarsherlock(在蜂窝以下的版本上).但是在 ICS 中,我在操作栏下方有一个我不想要的阴影.让它消失的样式项是什么?

And it works for actionbarsherlock (on versions below honeycomb). But in ICS I have a shadow below actionbar which I don't want. What is the style item to make it disappear?

推荐答案

让它消失的样式项是什么?

What is the style item to make it disappear?

为了消除阴影,请将其添加到您的应用主题中:

In order to remove the shadow add this to your app theme:

<style name="MyAppTheme" parent="android:Theme.Holo.Light">
    <item name="android:windowContentOverlay">@null</item>
</style>

更新:正如@Quinny898 所说,在 Android 5.0 上这已经改变了,您必须在操作栏上调用 setElevation(0).请注意,如果您正在使用支持库,则必须像这样调用它:

UPDATE: As @Quinny898 stated, on Android 5.0 this has changed, you have to call setElevation(0) on your action bar. Note that if you're using the support library you must call it to that like so:

getSupportActionBar().setElevation(0);

这篇关于删除操作栏下方的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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