AppBarLayout在设计支持库中使用窗口小部件时,工具栏底部会显示阴影.我该如何移除阴影?
嗨我想从我的工具栏中删除API 21及更高版本的高程和阴影效果.以下是我的尝试
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setElevation(0);
Run Code Online (Sandbox Code Playgroud)
我的XML工具栏.我试图将高程设置为0dp
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:elevation="0dp"
android:theme="@style/ToolbarStyle"
app:theme="@style/ToolbarStyle"
>
Run Code Online (Sandbox Code Playgroud)
如果有帮助的话,这就是ToolbarStyle
<style name="ToolbarStyle" parent="ThemeOverlay.AppCompat.Dark">
<item name="colorControlNormal">@android:color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
编辑1:在样式v21中尝试以下操作.还是一样的结果
<style name="ToolbarStyle" parent="ThemeOverlay.AppCompat.Dark">
<item name="colorControlNormal">@android:color/white</item>
<item name="android:elevation">0dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)
编辑2:工具栏在我的布局中
android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/toolbar" />
Run Code Online (Sandbox Code Playgroud)