我怎样才能把MaterialDrawer菜单放在ActionBar之上?现在,当我打开MaterialDrawer菜单时,我的ActionBar就在上面。CSS中有类似Z索引的东西吗?:D我的应用程序样式:
<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()发布于 2015-09-12 19:41:57
正如@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);Done
https://stackoverflow.com/questions/31959262
复制相似问题