【发布时间】:2015-01-15 05:44:33
【问题描述】:
我有一个带有导航抽屉的活动,它替换了活动上的 main_fragment_container。 当显示其中一个片段时,我想更改工具栏的布局并为其添加一个微调器(并在片段隐藏时将其删除)。
我的布局是这样的:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_parent_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
sothree:theme="@style/AppTheme.ActionBar" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Main layout -->
<FrameLayout
android:id="@+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Nav drawer -->
<fragment
android:id="@+id/fragment_drawer"
android:name="com.idob.mysoccer.ui.DrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="left|start" />
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
-
这将使抽屉在工具栏下方打开。 The Navigation Drawer is specified in Material Design 与 ToolBar 重叠(但目前甚至 Google Play 都没有这样做)。
-
我是故意这样做的,在我的设计中,抽屉在工具栏上方时看起来不太好。
标签: android navigation-drawer material-design android-toolbar