I am experimenting with the new translucent navigation panels of Android 4.4 and would like to set the navigation bar as translucent using the FLAG_TRANSLUCENT_NAVIGATION flag. I want the navigation bar (back, home button, etc.) to be translucent - I want the status bar at the top of the screen to display normally;
The code I use for this:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); }
The problem I ran into is that Android now thinks that the Activity is full-screen and places the layout behind the navigation bar (which is true), unfortunately, it also places the layout behind the status bar (problem).
A hack fix for this would be to apply an addition to the top of the layout of the parent view, however I need to determine the height of the status bar to do this.
Can anyone suggest how I get the height of the status bar, this is not as trivial as I thought it would be or, alternatively, offer the right solution.
thank
android android-layout view android-4.4-kitkat
Milo Dec 14 '13 at 14:12 2013-12-14 14:12
source share