【发布时间】:2019-06-28 06:04:23
【问题描述】:
我正在尝试使用 xml 实现如下图所示的行为。请注意,颜色在中间突然变化,而不是颜色的逐渐变化。我认为这可以使用渐变来实现,但我不知道如何。有没有办法使用渐变或使用xml的任何其他方式来实现它?
这是我当前的 xml 代码的样子:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#E86D52"
android:startColor="#E11E26" />
<corners android:radius="10dp" />
<stroke
android:width="1.5dp"
android:color="#231F20" />
</shape>
这是我想要实现但不知道如何实现的示例图片:
【问题讨论】:
标签: android android-drawable linear-gradients