android - 如何制作不同颜色的自定义按钮?

标签 android xml

<?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。我想修改代码以获得两种或更多颜色。

最佳答案

startColorendColor 的渐变已经给出了 2 种颜色。可以使用 android:centerColor="#hexcode" 添加中心颜色。

关于android - 如何制作不同颜色的自定义按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6214225/

相关文章:

xml - JAXB 2 注释和 XSD

android - Retrofit - 网络调用导致应用程序挂起

Android Jetpack 导航 : How to get fragment instance of destination in OnNavigatedListener?

android - 我怎么知道键盘是打开的

PHP/XPATH - 查找父级的前一个 sibling 并获取其子级

java - 推土机 : primitive int -1 value to null object mapping

java - 文件和图像未加载 Spring MVC

javascript - 在 Javascript 中解析 XML

android - Visual Studio Enterprise 2015 RC Cordova Android 构建退出代码 1

android - 广播接收器没有收到额外的东西