FitsSystemWindows in preview

Question: android:fitsSystemWindows="true" in the layout is not taken into account in the preview of the studio layout. Why is this so and how can I make it show correctly in the layout preview?

I am using a theme with the following flag

 <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation">true</item> 

I have a layout file

 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!"/> </android.support.design.widget.CoordinatorLayout> 

Here's how it looks in a preview enter image description here

This is how it looks on the device enter image description here

As you can see, "Hello World!" ( android:fitsSystemWindows does not work here), but is located under the system panel on the device ( android:fitsSystemWindows works here)

+5
source share

Source: https://habr.com/ru/post/1273020/


All Articles