skyfoot skyfoot - 1 year ago 117
Android Question

Android drawCircle with different colour border

Is it possible to draw a circle on a canvas in Android with a different colour border using only one


I have noticed the PaintStyle of FILL_AND_STROKE but cant seem to have different colours for both the fill and the border.

I really don't want to have to call two drawCircle methods.

Answer Source

Definition of Paint.Style says:

Paint.Style The Style specifies if the primitive being drawn is filled, 
stroked, or both (in the same color). 

So it seems it can't be done in one go.

If you do this a lot you can create a static helper method that does two calls to draw bordered circle.

Or you could create a custom object and override its draw(..) method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download