相关疑难解决方法(0)

Android Gradient可绘制颜色变化

我在drawable文件夹中有一个可绘制的形状.这是XML结构:

<?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>  
Run Code Online (Sandbox Code Playgroud)

现在我想从运行时的java代码中更改startColor,centerColor,endColor.如何改变?

android gradient colors shape

3
推荐指数
1
解决办法
2709
查看次数

标签 统计

android ×1

colors ×1

gradient ×1

shape ×1