2

How I can put MaterialDrawer menu above ActionBar? Now, when I open MaterialDrawer menu, my ActionBar is on top of it. Is there is any thing like Z-index in CSS? :D My application style:

<resources xmlns:android="http://schemas.android.com/apk/res/android">
  <style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/ActionBar</item>
  </style>
  <style name="ActionBar" parent="Widget.AppCompat.Light.ActionBar">
    <item name="background">@color/yellow_dark</item>
  </style>
</resources>

My MaterialDrawer initialization code:

DrawerBuilder().withActivity(activity).addDrawerItems(...).withSelectedItem(-1).withTranslucentStatusBar(false).withActionBarDrawerToggle(false).build()
mikepenz
  • 12,708
  • 14
  • 77
  • 117
igor_rb
  • 1,821
  • 1
  • 19
  • 34
  • http://www.androidhive.info/2015/04/android-getting-started-with-material-design/ – SANAT Aug 12 '15 at 08:26
  • Solution - is replase ActionBar with [Toolbar](https://developer.android.com/intl/ru/reference/android/widget/Toolbar.html) – igor_rb Sep 09 '15 at 07:33

1 Answers1

5

As already noted by @igor_rb this is only possible if you switch from an ActionBar to a Toolbar.

See the following already answered issues at github https://github.com/mikepenz/MaterialDrawer/issues/523 https://github.com/mikepenz/MaterialDrawer/issues/522 https://github.com/mikepenz/MaterialDrawer/issues/333

Switching to a Toolbar is really easy.


Use an AppCompatActivity Define the Toolbar within your layout

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        android:elevation="4dp" />

Set the Toolbar as SupportActionBar

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

Done

mikepenz
  • 12,708
  • 14
  • 77
  • 117