0

I'm having trouble with android app. I try to make my action bar transparent (like google maps or google play music) but instead of becoming transparent it becomes white.

Here is my custom theme:

<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:windowActionBarOverlay">true</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
    <item name="android:background">@android:color/transparent</item>
    <item name="android:logo">@android:color/transparent</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#FFFFFF</item>
</style>

Has anyone got any ideas why is that happening ?

EDIT 1:

I forgot to mention that I'm using fragments. So I have only one activity with Navigation Drawer and a fragment inside. The fragment itself contains a listview.

Thank you all in advance !

tvoloshyn
  • 407
  • 8
  • 22

1 Answers1

0

You can try the answer in this thread: Transparent Actionbar: custom tabcolor

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

The one changes the color of the ActionBar and the other the color of the tabs attached to it. If you want to make it completely transperant then your first number of the color should be 00: #00123456, because the colors are in the (Alpha, Red, Green, Blue) schema.

Community
  • 1
  • 1
  • I already tried it and it doesn't work. It looks like there is some "background view" inside action bar and when I change background color through XML or code only "foreground view" is changing and that is why I see white color when I set it completely transparent. – tvoloshyn Oct 03 '14 at 17:04