【问题标题】:Button background layer list not drawing properly按钮背景图层列表未正确绘制
【发布时间】:2015-09-30 10:08:46
【问题描述】:

我已经定义了一个 layer-list 可绘制作为按钮的背景,但它没有正确显示,这是代码和生成的图像

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="@dimen/Button.Login.Radius" />
            <solid android:color="#33455964"/>
        </shape>
    </item>

    <item android:bottom="5dp">
        <shape android:shape="rectangle">
            <corners android:radius="@dimen/Button.Login.Radius" />
            <solid android:color="#26a69a" />
        </shape>
    </item>
</layer-list>

为什么角上有不同的颜色?

【问题讨论】:

  • 你的意思是说角落的颜色不同?
  • 尝试使用不同颜色的阴影和检查。这也是设备/模拟器上的预览或结果吗?
  • 使用不同的颜色,边角显示正确,可能是因为我原来的颜色是一个alpha值为0.2的rgba?
  • 也发布你的颜色值
  • @Eric Android Studio 的预览完全不准确。始终运行您的应用以查看其外观。

标签: android android-drawable


【解决方案1】:

在模拟器上看起来很完美(nexus 具有 api 级别 19):

似乎是预览中的一些错误。

【讨论】:

    猜你喜欢
    • 2011-09-07
    • 1970-01-01
    • 2012-11-26
    • 1970-01-01
    • 2020-06-19
    • 1970-01-01
    • 2019-12-20
    • 1970-01-01
    • 2014-10-02
    相关资源
    最近更新 更多