I would like to draw
EditText username = new EditText(context);
to a specific spot on my canvas in
protected void onDraw(Canvas canvas) {
}
Is it possible to draw it on the basis of x,y
coordinate in my Java file without using XML layout?
Yes you can draw
EditText
onCanvas
, Here is hint:You can create/initialize
EditText
at run time like this:You can't draw an EditText to canvas in Android. That's not what Canvas is for.
What you can do is use a FrameLayout, put the Canvas inside of it, and put and EditText on top of the Canvas.