问题很简单:如何在 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/