Mercury
Mercury

Reputation: 7988

Getting current stroke color programmatically

I am able to set my shape's stroke color by doing this:

GradientDrawable shape = (GradientDrawable) myview.getBackground();
shape.setStroke(strokeWidth, color);

Q: How do I get the current color of my shape's stroke programmatically?


Note that I am using API level 19 (so I cannot use shape.getColor() which anyway would return the filling color of the shape I believe, and not it's stroke's color).

Upvotes: 2

Views: 322

Answers (1)

Mercury
Mercury

Reputation: 7988

As @pskink mentioned, Checking android sources shows that there is no such API for getting the current stroke color (which is odd and a pity).

Eventually what I did to overcome my problem, is keeping my own variable in code that indicates the current stroke color.

Upvotes: 1

Related Questions