Android的绘制渐变颜色变化 [英] Android Gradient drawable color change

查看:1227
本文介绍了Android的绘制渐变颜色变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在绘制文件夹的形状绘制。下面是XML结构:

I have a shape drawable in the drawable folder. Here is XML structure:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient 
        android:startColor="#4D0418" 
        android:centerColor="#5F031D"
        android:endColor="#7D0227" 
        android:angle="-90" />
</shape>  

现在我想从运行在Java code改变startColor,centerColor,ENDCOLOR。它是如何可能改变?

Now I want to change the startColor, centerColor, endColor from the java code in the runtime. How it is possible to change?

推荐答案

不幸的是有没有API来做到这一点。我将添加一个未来的Andr​​oid版本。

Unfortunately there's no API to do this. I'll add one to a future Android release.

这篇关于Android的绘制渐变颜色变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆