<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#4CC417" android:endColor="#7C4124" android:angle="270"/>
<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
这是我的自定义按钮 xml。我想修改代码以获得两种或更多颜色。
最佳答案
从 startColor
到 endColor
的渐变已经给出了 2 种颜色。可以使用 android:centerColor="#hexcode"
添加中心颜色。
关于android - 如何制作不同颜色的自定义按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6214225/