android - 在 coordinatorLayout android 中的 navigationBar 下方设置布局

标签 android android-layout

问题很简单:如何在 coordinatorLayout 中设置(任何)布局波纹管导航栏?

如果我在 RelativeLayout 中使用 frameLayout,RelativeLayout 高度会填满整个屏幕,包括导航栏。

这是我的代码:

<RelativeLayout
    android:id="@+id/drawer_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="false"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <FrameLayout
        android:id="@+id/frameLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/primary"
        app:layout_scrollFlags="scroll|enterAlways"
        android:minHeight="?android:attr/actionBarSize"
        app:popupTheme="@style/MaterialDrawerTheme.Light.DarkToolbar"
        app:theme="@style/ToolbarTheme">

            <TextView
                android:id="@+id/toolbar_title"
                style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:gravity="center"
                android:textColor="@color/icons" />

    </android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

还有问题(在我添加 frameLayout fragment 之后): image 1

以及 Android Studio 预览屏幕: image 2

(对不起图片,目前我没有足够的反感直接在这里发布:( )

最佳答案

android:fitsSystemWindows更改为false:

android:fitsSystemWindows="false"

关于android - 在 coordinatorLayout android 中的 navigationBar 下方设置布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31886417/

相关文章:

android - 支持多种屏幕尺寸的文本

android - 如何在 map 图钉图像上设置索引号

android - "already added"ormlite 和 gradle 异常

android - 从安卓相机中提取 EXIF 数据

java - 处理大图像

android - 创建自定义开关

Android studio Logcat 显示结果缓慢

android - java.lang.RuntimeException : Unable to start activity ComponentInfo , android.content.res.Resources$NotFoundException 异常

android - 如何设置 BottomNavigationBar 菜单项之间的间距相等?

android - 是否有像素密度为 xxhdpi 的 720dp 设备?