Android KitKat: all the contents of my application appear behind the ActionBar and StatusBar after changing the color of the StatusBar

I created a separate KitKat-oriented xml style file and I managed to change the color of the status bar. The only side effect, as can be seen in the picture, all content is now moved under the status bar. My question is how to change the color of the status bar without overlaying it or how can I find out the exact top field that I need to place on my content so that it starts after the ActionBar, and not under it. Of course, I need this to be as expected on all screen sizes and densities. thank you

Navigation drawer and all content appears beneath the ActionBar and Status Bar

values-v19 / styles.xml

<style name="ThemeSelector" parent="android:Theme.Holo.Light"> <item name="android:actionBarStyle">@style/ActionBar</item> <item name="android:windowTranslucentStatus">true</item> </style> 
+6
source share
3 answers

At the top of the view (s), add the following:

 android:paddingTop="?android:attr/actionBarSize" 

If you use the support library for the action bar, you need to remove the android: prefix prefix

 android:paddingTop="?attr/actionBarSize" 

By enabling translucent system panels, your layout will fill the area behind the system panels, so you should also include fitsSystemWindows for the part of your layout that should not be covered by system bars.

+11
source

EDITED

You can add

 android:fitsSystemWindows="true" 

in your xml file

+1
source

Remove from layout

  android:fitsSystemWindows="true" 
+1
source

All Articles