android:fitsSystemWindows not working

Use CoordinatorLayout as root for your view, it worked for me.

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

My problem was most likely related to multiple/nested fitsSystemWindows attributes which does not work as I found out later. I solved my problem by applying the attribute to one view, and then copy the paddings to other views that need them via an ViewTreeObserver.OnGlobalLayoutListener. That is an ugly hack, but does its job for now.


I meet the same problem in Android 4.4

My problem is <item name="android:windowTranslucentStatus">true</item>

conflict with <item name="android:fitsSystemWindows">true</item>

My way is remove <item name="android:windowTranslucentStatus">true</item>