Transparent ActionBar is not working

廉价感情. 提交于 2019-12-24 03:41:36

问题


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: like the bar in the screenshot below. Looks like this. It's just grey:

Please help me!


回答1:


try this code

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

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

Call setStackedBackgroundDrawable() on your 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")));

OR this link , this code

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

For making ActionBar Transparent.Hope this helps.




回答2:


for back ground you can use :

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

i hope it will help



来源:https://stackoverflow.com/questions/22353011/transparent-actionbar-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!