2

How do I overlay image over an Action Bar and status bar? Here is what I want it to look like -

Target

I read this but it gives different results than what I want. The Action Bar still has some opacity and the status bar has no effect at all.

Is there any way to do this?

Andrew Quebe
  • 2,263
  • 5
  • 25
  • 53
Confuse
  • 5,646
  • 7
  • 36
  • 58

2 Answers2

3

Add these two lines of code to your styles-v21.xml file:

<item name="android:windowTranslucentStatus">true</item>
<item name="windowActionModeOverlay">true</item>

Edit: You want it in the v21 file because Android versions below 5.0 don't support this.

Also...for Material Design, you should be using a ToolBar not an Action Bar. Here's how to change the color of a Toolbar.

toolbar.getBackground().setAlpha(0);
Andrew Quebe
  • 2,263
  • 5
  • 25
  • 53
2

Check this answer.

This one worked perfectly in my project.

This library is also great to explore: https://github.com/ManuelPeinado/FadingActionBar

Community
  • 1
  • 1
Mohammad Arman
  • 7,020
  • 2
  • 36
  • 50
  • 3
    While that listed library is good, there's an even more powerful one here: https://github.com/ksoichiro/Android-ObservableScrollView – Andrew Quebe May 24 '15 at 07:29
  • No problem! I found it a couple days ago and implemented it into my app. It's beautiful! There's also some other types of things like FlexibleSpace as well. – Andrew Quebe May 24 '15 at 07:32
  • Thanks for your answer. While this will work, is there any way to do this without scrolling? Can I add a fixed image? – Confuse May 24 '15 at 07:40