Android Removing an oval section from a canvis -


basically trying draw o shape. there way (besides matching background colors) can make can draw 2 oval's , have center oval of canvas transparent way through background of activity?

here have far:

protected void ondraw(canvas canvas) {      if(maintimerangle - 90 < 0){         maintimerangle += 270;     }      canvas.drawarc(new rectf(0, 0, canvas.getwidth(), canvas.getheight()),                                           -90, maintimerangle-90,true, maintimerpaint);      canvas.drawoval(new rectf(barwidth, barwidth, canvas.getwidth() - barwidth,                                       canvas.getheight() - barwidth), backgroundpaint);  } 

yes, can, using paint instance porterduff.mode.clear mode set inner oval.

the clear mode erase pixels draws. consequence, you'll want drawing on dedicated bitmap opposed directly on background of view. if don't, you'll find erasing background directly lead black hole.

here links useful resources. they'll give overview of various modes , visual results.

there's sample code available in api demos, should able find in android sdk folder. on lookout com.example.android.apis.graphics.xfermodes. alternatively, find the latest source code class here.