在布局文件中添加 android:fitsSystemWindows="true"如下所示 android:orientation="vertical" android:layout_width="match_parent" android:fitsSystemWindows="true" android:layout_height="match_parent">