How it is possible to get Gradientrawable
colors set by setColors(@ColorInt int[] colors)
?
Any help will be appricated.
How it is possible to get Gradientrawable
colors set by setColors(@ColorInt int[] colors)
?
Any help will be appricated.
Please reference GradientDrawable.java then make some proper modification for result as required.
public class ColorGradientDrawable extends Drawable {
...
private int mColor; // this is the color which you try to get
...
// original setColor function with little modification
public void setColor(int argb) {
mColor = argb;
mGradientState.setSolidColor(argb);
mFillPaint.setColor(argb);
invalidateSelf();
}
// that's how I get the color from this drawable class
public int getColor() {
return mColor;
}
...
// This is same as GradientState, just make some proper modification to make it compilable
final public static class GradientState extends ConstantState {
...
}
}