我需要把这个像项目的背景放在列表中,它工作正常。如果我想开始和结束颜色相同但更改为 first_color(start)->second_color(center)->first_color(end) 应该更改什么?
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#aa0099"
android:endColor="#aa0099"
android:angle="270"
/>
<corners android:radius="1dp"/>
</shape>
最佳答案
试试这个作为中心
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#aa0099"
android:centerColor="#9900aa"
android:endColor="#aa0099"
android:angle="270"
/>
<corners android:radius="1dp"/>
</shape>
因为您可以设置 centerColor 的颜色并检查角度值
关于android - 添加渐变变化到中心和背面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8165197/