I'm setting up a simple view which just contains an empty RelativeLayout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
android:background="@color/red"/>
Using this theme:
<style name="FullscreenTheme" parent="BaseTheme">
<item name="android:textColorSecondary">@android:color/white</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
And this in onCreate:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
This results in the intended effect:
However, when I try to add a child, I can't get it to do the same thing. The XML looks like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
android:background="@color/red">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bit_teal"
android:fitsSystemWindows="true"
android:clipToPadding="false"/>
</RelativeLayout>
And here is what it looks like:
Any ideas?