adding image inside dynamically created circle in canvas Android -



adding image inside dynamically created circle in canvas Android -

i trying create hollow circle , set image within it. have imageview statically in xml file. hollow circle creating dynamically utilize of paint class.

the issue can draw both , visible when set hollow circle on image overlaps imageview , image not visible.

another issue not know how set both of them in center of layout. here java code snippet

relativelayout rl = (relativelayout) findviewbyid(r.id.panel); circle view = new circle(myactivity.this); viewgroup.layoutparams params = new viewgroup.layoutparams(layoutparams.fill_parent, layoutparams.fill_parent); rl.addview(view);

code draw circle

private class circle extends view { public circle(context context) { super(context); } @override public void draw(canvas canvas) { paint mpaint = new paint(); mpaint.setcolor(color.black); canvas.drawcircle((int) (500), (int) (430), 320, mpaint); mpaint.setcolor(color.blue); canvas.drawcircle((int) (500), (int) (430), 300, mpaint); } }

can help define both image within circle in center know need pass x, y coordinates while drawing circle here how know center(x,y) - radius coordinate circle. thanks

android android-layout canvas paint

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -