dev_android
dev_android

Reputation: 8818

Android Gradient drawable color change

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>  

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

Upvotes: 3

Views: 2875

Answers (1)

Romain Guy
Romain Guy

Reputation: 98501

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

Upvotes: 12

Related Questions