How to make custom buttons with different colors?

<?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> 

This is my custom xml button. I want to change the code to get two or more colors.

+3
source share
1 answer

The gradient from startColorto endColoralready gives 2 colors. The color of the center can be added with android:centerColor="#hexcode".

+2
source

All Articles