如何使抽屜佈局位於操作欄/工具欄下方?我正在使用v7:21應用程序compat庫和新的ToolBar視圖。如何讓DrawerLayout顯示在工具欄下方?
例子,我看到的樣子
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- drawer view -->
<LinearLayout
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="left|start">
<!-- drawer content -->
</LinearLayout>
<!-- normal content view -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/my_awesome_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<!-- The rest of content view -->
</LinearLayout>
但隨後的工具欄將被抽屜,這使得動畫漢堡包圖標(如v7.ActionBarDrawerToggle)被隱藏無用的,因爲它不會是在抽屜下方可見,但我確實想使用新的工具欄視圖來更好地支持Material主題。
那麼如何做到這一點呢?是否可以將DrawerLayout作爲非頂級視圖?
http://www.journaldev.com/12648/navigati onview-android – AnupamChugh 2016-09-19 08:24:52
這可能有助於http://www.gadgetsaint.com/android/android-navigation-drawer-toolbar/#.WOBABBJ97fY – ASP 2017-04-02 00:11:30
@AnupamChugh - 您在上面提供的鏈接(** journaldev.com/12648/navigationview- android **)的確是我想要的。謝謝!! – 2018-03-07 10:03:37