Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlay action bar with a translucent status bar

I'm trying to achieve the effect shown here: http://www.youtube.com/watch?v=6QHkv-bSlds&t=15m48s by Nick and the boys. I can get the action bar to be overlayed, but cannot figure out how to extend this to the status bar. I would also like to know how they managed the transparent black background behind the navigation bar (but this isn't as crucial).

Any help / advice would be greatly appreciated as I currently have no idea how this is done (and am starting to worry it may just be an image rather than an actual implementation).

Edit: i know how to make the bars fully transparent (thats the easy part)! I dont know how to extend the actionbar background to appear behind the now transluscent status bar

like image 874
krishan711 Avatar asked Nov 05 '13 21:11

krishan711


2 Answers

I had the same question and found this library: https://github.com/jgilfelt/SystemBarTint

Have a look at line 300 in: https://github.com/jgilfelt/SystemBarTint/blob/master/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java

setupStatusBarView() Adds a view to the window's decor. This allows you to later set a color/drawable to this view.

If using the SystemBarTint library, the following will allow you to force the status bar to a specified color, which you can then match to your action bar's background:

SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(Color.parseColor("#DD000000"));

In this case you would set your action bar's background to: #DD000000

like image 54
Tanner Perrien Avatar answered Sep 27 '22 21:09

Tanner Perrien


As described in the Android 4.4 APIs:

You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows for the portion of your layout that should not be covered by the system bars.

If you're creating a custom theme, set one of these themes as the parent theme or include the windowTranslucentNavigation and windowTranslucentStatus style properties in your theme.

In your case (where you want the ActionBar), the second option - including the two new properties into your theme - will give you a translucent Navigation and Status bar.

like image 31
ianhanniballake Avatar answered Sep 27 '22 22:09

ianhanniballake