透明的动作条不工作透明、动作、工作

2023-09-12 03:10:24 作者:一直思念你

我不能够设置透明度或任何其他颜色的动作条。我style.xml:

I'm not able to set the transparency or any other color to the Actionbar. My 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:喜欢扎在下面的截图。 看起来是这样。这只是灰色的:

tranlucent_color: like the bar in the screenshot below. Looks like this. It's just grey:

请帮帮我!

推荐答案

试试这个code

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

如果这一点儿也不帮助你,请与此code此链接

If this does'nt helps you, Check this link with this Code

呼叫 setStackedBackgroundDrawable()动作条

getWindow()requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)。 动作条动作条= getActionBar(); actionBar.setBackgroundDrawable(新ColorDrawable(Color.parseColor(#330000ff))); actionBar.setStackedBackgroundDrawable(新ColorDrawable(Color.parseColor(#550000ff)));

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链接,这code

OR this link , this code

&LT;样式名称=MyTheme的父=Theme.Sherlock&GT;     ...     &LT;项目名称=windowActionBarOverlay&GT;真&LT; /项目&GT; &LT;! - 为ActionBarSherlock - &GT;     &LT;项目名称=机器人:windowActionBarOverlay&GT;真&LT; /项目&GT; &LT; /风格&GT;

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

为了使动作条Transparent.Hope这会有所帮助。

For making ActionBar Transparent.Hope this helps.