我在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.如何改变?