非全屏Activity A跳轉到全屏Activity B後,返回A時介面跟隨狀態列下移
阿新 • • 發佈:2019-02-14
在Activity A的佈局外加一層CoordinatorLayout,並設定android:fitsSystemWindows="true",如下所示
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" > <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar style="@style/ToolbarTheme"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/go_back" style="@style/ToolbarGoBackTextStyle" /> <TextView style="@style/ToolBarTitleTheme" android:text="@string/live" /> </RelativeLayout> </android.support.v7.widget.Toolbar> <android.support.v7.widget.RecyclerView android:id="@+id/live_list" android:layout_width="match_parent" android:layout_height="match_parent"/> </LinearLayout> </android.support.design.widget.CoordinatorLayout>