How to get text input on canvas?

I am new to the Android world and I have a very nasty problem. In my program, I use Android Canvas. I would like to add an EditText element or something like that to get custom text inputs. Can you help me find a way to solve this problem?

Thanks for answers.

+8
android input android-edittext android-canvas
source share
1 answer

Initially, you cannot put editing text or canusig canvas. Instead, you should draw it. So, create your own layout and draw this layout with canvas

Try it, it can help you. in onDraw(..)

  LinearLayout lL = new LinearLayout(context); EditText editTextView = new EditText(context); editTextView.setVisibility(View.VISIBLE); lL.addView(editTextView); lL.measure(canvas.getWidth(), canvas.getHeight()); lL.layout(0, 0, canvas.getWidth(), canvas.getHeight()); // placing the edit text at specific co-ordinates: //canvas.translate(0, 0); layout.draw(canvas); 

And take a look at this another example: Click here

This provides another way to add views.

+3
source share

All Articles