32

How can I make the navigation bar transparent on Android 4.4.X and above?

I have searched in the documentation, but found nothing about this.

Björn Ternes
  • 1,137
  • 4
  • 14
  • 33

2 Answers2

39

I have taken this from the change log for Android KitKat (4.4):

Translucent system bars

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.

Hope this helps get you started.

Community
  • 1
  • 1
deloreyk
  • 1,248
  • 15
  • 24
  • 1
    Actually if you use fitSystemWindows to true in the theme, you may affect to other views like toasts and dialogs, see this answer https://code.google.com/p/android/issues/detail?id=63653 – Fernando Gallego Dec 19 '13 at 10:53
  • 2
    What is written above is correct then, according to the answer. "fitsSystemWindows for the **portion** of your layout that should not be covered by the system bars." and in the answer: "You should only specify fitsSystemWindows on **views within your layouts** or in styles that you explicitly apply to views within your layouts, not on themes." – deloreyk Dec 19 '13 at 15:00
  • Nexus 10 doesn't support it in 4.4.4. Immersive mode has its usual transparency but TRANS_STATUS and TRANS_NAV are ignored when showing "real" status and nav – robotoaster Jul 04 '14 at 15:02
3

I used your trevor-e's answer, by creating a custom theme in my styles.xml

<style name="Theme.HomeScreen" parent="android:Theme.Holo.NoActionBar.TranslucentDecor">
 <item name="android:windowBackground">@android:color/transparent</item>
             <item name="android:windowNoTitle">true</item> 
        </style>

and then you can set the theme from the manifest

<activity
            android:name="MyActivity" 
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.HomeScreen" >
     </activity> 
codercat
  • 22,873
  • 9
  • 61
  • 85
roomtek
  • 3,747
  • 2
  • 21
  • 22