【发布时间】:2017-08-03 23:58:09
【问题描述】:
我正在开发一个 android 应用程序,我正在尝试删除我的 AppBar 下的阴影,我尝试使用 android:elevation="0dp" 但它对我不起作用,我尝试了 <item name="android:windowContentOverlay">@null</item> 样式但它也没有用,这是我的代码:
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,有什么帮助吗?
【问题讨论】:
-
您为什么要尝试在该 API 级别使用 Holo 主题?工具栏阴影来自 AppCompat / Material 主题
-
@cricket_007 我没有尝试使用它,我只是在其他问题的解决方案中找到了该解决方案,我尝试了它但它没有用,我什至尝试了另一个在我的 xml 文件上使用提升,还是不行!!
-
android:windowContentOverlay可能在其他问题中,但不一样parent...您确定您正在编辑正确的主题吗?例如,改为使用 res/values-v21 -
我也尝试过编辑,但阴影总是出现! @cricket_007
-
请将您的清单添加到说明您正在使用哪个主题的问题中,并删除所有与版本相关的额外值文件夹
标签: android android-appbarlayout appbar