I'm developing an app where I need to draw a EditText on my canvas. I was able to do this, but
I can just see it, not use it. Here is how I've initialized the EditText
et = new EditText(MyActivity.this);
et.setText("edittext");
et.setBackgroundColor(Color.GRAY);
et.requestFocus();
//add it to a LinearLayout
layout.addview(et);
what am I missing to make the EditText actually usable?
You might use this code, in
main
add this method to get input keys:in class which extends view class:
You will need to store the text in an object, this object contains
x, y, width, height, string
in the
onTouch
method, check if the click is in the same text, then makenew EditText >> false
and make the old key to be modified.This is not a perfect solution.But i hope it gives you some idea :)
set EditText InputType like this :
or Check Full code based on this :