<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/content_main"/>
</FrameLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
ただし、RecyclerViewを追加すると、
ツールバーの下にナビゲーションドロワーを配置したいのですが、概説した方法以外の方法はありますか?
前もって感謝します。
CoordinatorLayout
が必要ない場合は、次のサンプルのように行うこともできます。
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomContainerActivity.java
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/res/layout/activity_sample_custom_container_dark_toolbar.xml
上記では、 RecyclerView
はID drawer_layout
のレイアウト内にある必要があります。 代わりにinclude
@ Meeks91報告してください。 今のところ閉じます
同じ問題がありました。 あなたの解決策は魅力のように機能しました、ありがとう!