如何使用AppCompat.Light.NoActionBar删除操作栏下方的阴影? [英] how to remove shadow below actionbar with AppCompat.Light.NoActionBar?

查看:97
本文介绍了如何使用AppCompat.Light.NoActionBar删除操作栏下方的阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用曾有答案的人的所有建议,使用Theme.AppCompat.Light.NoActionBar删除工具栏下方的阴影,但没有人起作用.我尝试过

I tried to remove the shadow below the toolbar with the Theme.AppCompat.Light.NoActionBar, using every recommendation of people who have ever answer it before, but no one worked. I tried

<item name="android:windowContentOverlay">@null</item>    

<item name="android:windowContentOverlay">@drawable/solid_line</item> ....

<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle">
<solid android:color="@color/accueil_color" />
<size android:height="15dp" />
</shape>

并以此

android:elevation="0dp"

阴影从屏幕顶部消失,但不会消失.

the shadow goes from the top of the screen but not disapear.

您对完全删除此阴影线有任何想法吗?

Have you any idea for totally remove this shadow line ??

推荐答案

我不是专家,但几个小时前我遇到了同样的问题.因此,这里的想法是使用AppCompat我们必须管理库属性而不是Android属性.换句话说,请尝试使用app:elevation:

I'm not an expert but I run into the same problem just a few hours ago. So the idea here is that with AppCompat we have to manage the library attributes rather than Android attributes. In other words, instead of android:elevation try app:elevation:

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:fitsSystemWindows="true"
    app:elevation="0dp">

    <android.support.v7.widget.Toolbar
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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

我刚刚尝试了另一个没有AppBarLayout的选项.这样对我来说效果很好,阴影完全消失了.因此,我怀疑问题出在您的其他视图中.我不认为这是您的ToolBar蒙上阴影.

I just tried another option without AppBarLayout. This way works perfectly fine for me, the shadow is completely gone. So I suspect the problem is in your other View. I don't think it's your ToolBar drops the shadow.

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    app:elevation="0dp" />

这篇关于如何使用AppCompat.Light.NoActionBar删除操作栏下方的阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆