Android lollipop 5.0 上的工具栏阴影问题

Toolbar shadow issue on Android lollipop 5.0

我正在对我的应用程序进行最后润色,并注意到我的工具栏在设备 运行 5.0 及更高版本上有奇怪的行为。在低于 5.0 的设备上,我的图像下方没有奇怪的线条,我将其设置为工具栏的 backgroundDrawable,但在 5.0 及更高版本的设备上,工具栏似乎在图像后面可见。我尝试了很多我在 Whosebug 上发现的主要方法,但似乎没有任何效果。我尝试使用 transparent 背景,但没有用。我创建了带有 transparent 背景的自定义主题,但这也不起作用。以下是图片:

代码:

   <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:background="?attr/colorPrimary"
    android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolBar"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        android:background="@android:color/transparent"
        app:layout_scrollFlags="scroll|enterAlways">
        <ImageView
            android:id="@+id/icon"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/ic_logo_final"
            android:layout_gravity="center"
            android:gravity="center"
            android:layout_marginRight="50dp"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="15dp"
            />
     </android.support.v7.widget.Toolbar>
 </android.support.design.widget.AppBarLayout>
  <android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:id="@+id/recyclerView">
   </android.support.v7.widget.RecyclerView>
  </android.support.design.widget.CoordinatorLayout>

提前致谢。

试试这个从工具栏中删除阴影:

 <style name="MyAppTheme" parent="android:Theme.Holo.Light">
    <item name="android:windowContentOverlay">@null</item>
</style>

同时在 AppBarLayout 中设置 app:elevation="0dp" 以隐藏 appbar

中的阴影

由于工具栏的阴影功能..所以隐藏它..

尝试在 "android.support.design.widget.AppBarLayout" 中应用 "app:elevation="0dp" 来解决此问题。