2017-02-11 129 views
0

我正在做我的應用程序的最後一次接觸,並注意到我的工具欄上運行5.0和更高版本的設備上的奇怪行爲。在低於5.0的設備上,我的圖像下方沒有奇怪的線條,我爲工具條設置了backgroundDrawable,但在設備5.0和更高版本上,似乎工具欄在圖像後面可見。我嘗試了很多方法,我主要在這裏找到了stackoverflow,但似乎沒有任何工作。我嘗試了transparent背景,但沒有奏效。我也用transparent背景創建了自定義主題,但那不起作用。以下是圖像: Bellow Lollipop Lollipop and aboveAndroid棒棒糖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> 

在此先感謝。

+0

討厭投票時沒有解釋!如果你知道一些事情,請指導我,並將問題標記爲重複,如果它真的是,但提供解釋。似乎投票應該是罕有的特權。 – Yupi

回答

1

試試這個從工具欄中刪除陰影:

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

AppBarLayout還設置app:elevation="0dp"appbar

+0

謝謝!這解決了問題。 – Yupi

1

這是由於工具欄的陰影特徵躲在陰影..所以把它隱藏..

嘗試在「android.support.design.widget.AppBarLayout」中應用"app:elevation="0dp"來解決此問題。

+0

謝謝!贊同您的評論。 – Yupi

相關問題