开发者

How to make custom buttons with different color?

开发者 https://www.devze.com 2023-03-09 19:49 出处:网络
<?xml version=\"1.0\" encoding=\"UTF-8\"?> <shape xmlns:android=\"http://schemas.android.com/apk/res/android\" android:shape=\"rectangle\">
<?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 button x开发者_StackOverflow社区ml. I want to modify the code to get two or more colors.


A gradient from startColor to endColor already gives 2 colors. A center color can be added by using android:centerColor="#hexcode".

0

精彩评论

暂无评论...
验证码 换一张
取 消