0
I need to add a circle across the canvas every time I click a button (identical behavior to Paint from Windows). But to move the circle clicked on the screen I need an Id. Does anyone have any idea where I can add this Id? Thanks in advance.
0
I need to add a circle across the canvas every time I click a button (identical behavior to Paint from Windows). But to move the circle clicked on the screen I need an Id. Does anyone have any idea where I can add this Id? Thanks in advance.
1
The easiest way to do this is to create a Custom View
. Not to mention that this will probably avoid Boilerplate in your code.
private class CircleCanvas extends View {
public CircleCanvas(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
...
createCircle(...)
}
}
And when creating the circle in your code, use the method View#setId()
.
CircleCanvas circle = new CircleCanvas(ctx);
circle.setId(CIRCLE_ID);
Browser other questions tagged android canvas
You are not signed in. Login or sign up in order to post.
good!!! I believe it will solve my problem! Thank you.
– Android_man