fitsSystemWindows ignored by ConstraintLayout
I fixed it by adding the following code to my activity:
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Since I wanted to show my layout behind the status bar but still keep the navigation bar the same, this is what worked for me:
Add <item name="android:statusBarColor">@android:color/transparent</item>
to my activity theme
Since ConstraintLayout
does not seem to respect fitsSystemWindows
, wrap it in a CoordinatorLayout
.
Add android:fitsSystemWindows="true"
to my CoordinatorLayout
.
Add to my ConstraintLayout
android:fitsSystemWindows="true"
android:clipToPadding="false"
android:clipChildren="false"