布尔型内部属性,根据系统窗口(如状态栏)调整视图布局。如果为true,则调整此视图的填充,使系统窗口留出空间可以显示状态栏及导航栏。仅当此视图处于非嵌入式活动时才生效,即使在Acitivity的根布局才有效,在Fragment中的根布局设置是无效的。
<!-- Boolean internal attribute to adjust view layout based on system windows such as the status bar.If true, adjusts the padding of this view to leave space for the system windows.Will only take effect if this view is in a non-embedded activity. -->
<attr name="fitsSystemWindows" format="boolean" />
示例Activity布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="240dp"
android:scaleType="centerCrop"
android:src="@drawable/lufei"/>
...
</LinearLayout>
当android:fitsSystemWindows="false"
当android:fitsSystemWindows="true"