Hello, how to put the Navigation Drawer under the toolbar? so that when I pull this menu to the left, the toolbar will not climb out in advance
main activation onCreate method:
protected void onCreate(Bundle savedInstanceState) { // Для Activity с боковым меню ставьте эту тему, // для Activity без бокового меню ставьте тему AppThemeNonDrawer (она прописана по умолчанию в манифесте кстати) // иначе будет "сползать" ActionBar // Темы находятся в styles.xml setTheme(R.style.AppThemeDrawer); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // init Drawer & Toolbar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); headerResult = Utils.getAccountHeader(MainActivity.this, savedInstanceState); drawerResult = Utils.createCommonDrawer(MainActivity.this, toolbar, headerResult); drawerResult.setSelectionByIdentifier(1, false); // Set proper selection // Покажем drawer автоматически при запуске drawerResult.openDrawer(); } AndroidManifest:
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher2" android:label="@string/app_name" android:theme="@style/AppTheme" android:name=".HeadspaceApplication"> <activity android:name=".MainActivity" android:label="@string/title_activity_main" android:launchMode="singleTop"> <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> styles.xml:
<resources xmlns:tools="http://schemas.android.com/tools"> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat"> </style> <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> <item name="spinBars">true</item> <item name="color">@android:color/white</item> </style> <style name="AppThemeDrawer" parent="MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> <item name="android:windowBackground">@color/window_background</item> <item name="android:windowActionBar">true</item> </style> <style name="AppThemeNonDrawer" parent="MaterialDrawerTheme.Light.DarkToolbar"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorAccent">@color/accent</item> <item name="android:windowBackground">@color/window_background</item> </style> <style name="AppThemeStation" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item> </style> <style name="Theme.Transparent" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <item name="android:windowActionBar">true</item> <item name="android:windowFullscreen">false</item> <item name="android:windowNoTitle">true</item> <item name="android:windowDisablePreview">true</item> </style> <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored"/> <style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <item name="colorPrimary">@color/holo_blue_dark</item> <item name="colorPrimaryDark">@color/rt_green</item> <item name="colorAccent">@color/tc_orange</item> </style> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless" /> <style name="MyMaterialTheme" parent="MyMaterialTheme.Base" /> <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> it was possible to lower the entire navigation drawer under the toolbar, setting the program.withDisplayBelowToolbar (true) in the createCommonDrawer (...) method, but how can you make it just on top and not drop it down ??
