【问题标题】:Transparent ActionBar is not working透明操作栏不起作用
【发布时间】:2014-03-12 13:27:05
【问题描述】:

我无法为操作栏设置透明度或任何其他颜色。我的 style.xml:

<style name="thin_actionbar" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/thin_actionbar_style</item>

</style>
<style name="thin_actionbar_style" parent="android:Widget.Holo.ActionBar">
    <item name="android:height">60dp</item>
    <item name="android:homeAsUpIndicator">@drawable/ic_drawer</item>
    <item name="android:background">@color/translucent_control</item>
</style>

tranlucent_color:就像下面屏幕截图中的栏。 看起来像这样。它只是灰色的:

请帮帮我!

【问题讨论】:

  • 你能发帖R.color.translucent_control吗?

标签: android android-actionbar transparency


【解决方案1】:

试试这个代码

<item name="android:background">@null</item>

如果这对您没有帮助,请检查 this 与此代码的链接

在您的ActionBar 上致电setStackedBackgroundDrawable()

getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#330000ff"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#550000ff")));

this链接,此代码

<style name="MyTheme" parent="Theme.Sherlock"> ... <item name="windowActionBarOverlay">true</item> <!-- for ActionBarSherlock --> <item name="android:windowActionBarOverlay">true</item> </style>

为了让 ActionBar 透明。希望这会有所帮助。

【讨论】:

  • 谢谢!那行得通。我认为getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); 做到了。但现在我可以看到操作栏下方的导航抽屉。有没有办法把抽屉下面栏杆的部分去掉?
【解决方案2】:

你可以使用背景:

 <item name="android:background">@android:color/transparent</item>

希望对你有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-25
    相关资源
    最近更新 更多