在Android Button下无法摆脱阴影 [英] Can't get rid of shadow under Android Button
问题描述
我在屏幕上放置了一个Android按钮,并定义了一个自定义背景可绘制对象,该对象现在仅指定一个绿色矩形.但是,由于某种原因,在我的按钮下方似乎绘制了一个非常细的阴影(用红色框突出显示):
I have a Android Button that I'm placing on my screen, and am defining a custom background drawable that just specifies a green rectangle for now. But, for some reason there appears to be a very thin shadow being drawn under my button (highlighted with the red box):
在仍然使用Button的情况下,有什么方法可以摆脱这种情况?这是因为当我将可绘制背景更改为圆角时确实很丑.
Is there any way to get rid of this while still using a Button? It because really ugly when I change my background drawable to have rounded corners.
谢谢!
推荐答案
@alanv的评论是正确的答案:在Material上,您需要设置android:stateListAnimator ="@ null"才能删除默认的海拔动画.如果您不希望使用默认的Button样式,请使用View.
@alanv's comment was the correct answer: "On Material you need to set android:stateListAnimator="@null" to remove the default elevation animator. Alternatively, just use View if you don't want the default Button styling"
这篇关于在Android Button下无法摆脱阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!