我正在做我的應用程序的最後一次接觸,並注意到我的工具欄上運行5.0和更高版本的設備上的奇怪行爲。在低於5.0的設備上,我的圖像下方沒有奇怪的線條,我爲工具條設置了backgroundDrawable
,但在設備5.0和更高版本上,似乎工具欄在圖像後面可見。我嘗試了很多方法,我主要在這裏找到了stackoverflow,但似乎沒有任何工作。我嘗試了transparent
背景,但沒有奏效。我也用transparent
背景創建了自定義主題,但那不起作用。以下是圖像: Android棒棒糖5.0上的工具欄陰影問題
代碼:
<?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>
在此先感謝。
討厭投票時沒有解釋!如果你知道一些事情,請指導我,並將問題標記爲重複,如果它真的是,但提供解釋。似乎投票應該是罕有的特權。 – Yupi