2017-08-03 88 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"