我无法设置操作栏的透明度或任何其他颜色。我的 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:就像下面屏幕截图中的栏一样。 看起来像这样。它只是灰色的:
请帮助我!
最佳答案
试试这个代码
<item name="android:background">@null</item>
如果这对您没有帮助,请检查 this与此代码的链接
调用setStackedBackgroundDrawable()
在您的ActionBar
上
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 透明。希望这会有所帮助。
关于android - 透明 ActionBar 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22353011/