2015-08-12 2 views
1

Как я могу положить MaterialDrawer меню выше ActionBar? Теперь, когда я открываю меню MaterialDrawer, мой ActionBar находится поверх него. Есть ли что-то вроде Z-индекса в CSS? : D Мой стиль Применение:место MaterialDrawer над панелью действий

<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> 

Мой MaterialDrawer код инициализации:

DrawerBuilder().withActivity(activity).addDrawerItems(...).withSelectedItem(-1).withTranslucentStatusBar(false).withActionBarDrawerToggle(false).build() 
+0

час ttp: //www.androidhive.info/2015/04/android-getting-started-with-material-design/ – SANAT

+0

Решение - заменяет ActionBar на [Панель инструментов] (https://developer.android.com/intl/ru /reference/android/widget/Toolbar.html) –

ответ

4

Как уже отмечалось @igor_rb это возможно только, если переключиться с ActionBar к Toolbar.

Смотрите следующие уже ответили на вопросы GitHub https://github.com/mikepenz/MaterialDrawer/issues/523 https://github.com/mikepenz/MaterialDrawer/issues/522 https://github.com/mikepenz/MaterialDrawer/issues/333

Переключение на Toolbar очень легко.


Используйте AppCompatActivity Определить Toolbar в макете

<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" /> 

Установите Toolbar как SupportActionBar

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

Совершено