Android 将MaterialDrawer放置在操作栏上方
如何将菜单置于操作栏上方?现在,当我打开MaterialDrawer菜单时,我的操作栏就在上面。CSS中有类似于Z索引的东西吗D 我的应用程序样式:Android 将MaterialDrawer放置在操作栏上方,android,materialdrawer,Android,Materialdrawer,如何将菜单置于操作栏上方?现在,当我打开MaterialDrawer菜单时,我的操作栏就在上面。CSS中有类似于Z索引的东西吗D 我的应用程序样式: <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppTheme" parent="Theme.AppCompat.Light"> <item name="actionBarStyle"&
<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>
正如@igor_rb已经指出的,只有当您从
操作栏
切换到工具栏
时,这才是可能的
请参阅github上已回答的以下问题
切换到工具栏
非常简单
使用
AppCompatActivity
在布局中定义工具栏
<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" />
完成解决方案-是否使用
<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" />
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);