2017-08-03 86 views
0

我正在一個Android應用程序,我試圖刪除我的AppBar下的陰影,我試圖使用android:elevation="0dp"但它沒有爲我工作,我試過<item name="android:windowContentOverlay">@null</item>上風格,但它也不能工作,這是我的代碼:AppBar陰影不被刪除,android

Styles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 


    <style name="MyCheckBox" parent="Theme.AppCompat.Light"> 
     <item name="colorControlNormal">#005cb8</item> 
     <item name="colorControlActivated">#005cb8</item> 
    </style> 

</resources> 

activity_bienvenu.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/background" 
    android:fitsSystemWindows="true" 
    tools:context="molfix.dev.molfix.Activities.Bvn.BienvenuActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:elevation="0dp" 
     android:background="#91d0f0"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="45dp" 
      android:background="@drawable/toolbar_bienvenu" 
      android:scrollbars="none" 
      android:weightSum="1" 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 

     </android.support.v7.widget.Toolbar> 

    </android.support.design.widget.AppBarLayout> 

</RelativeLayout> 

我使用api 25作爲目標,最低爲19,任何幫助?

+0

你爲什麼想在這個API級別使用全息主題?工具欄的影子是從AppCompat /材質主題 –

+0

@ cricket_007我不想使用它,我只是在其他問題的解決方案上找到了解決方案,我嘗試了但它沒有工作,我甚至嘗試了另一個使用標高我的XML文件,仍然不工作! –

+0

'android:windowContentOverlay'可能在其他問題中,但不是相同的'parent' ...你確定你正在編輯正確的主題嗎?例如,正在使用res/values-v21 –

回答

0

我發現這個問題的答案,我不得不做的是使用:

app:elevation="0dp"