首页 > 学院 > 开发设计 > 正文

非全屏Activity A跳转到全屏Activity B后,返回A时界面跟随状态栏下移

2019-11-09 15:09:52
字体:
来源:转载
供稿:网友

在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>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表