Adding EditText box to android app based on x,y coordinates?
I am looking to be able to first detect touch events to draw a box whatever size the user wants on the canvas - this part I have completed.
I then need to take the coordinates of that box and create a edit开发者_JS百科text box in its place. Any Suggestions ? I would then like to make the text entered become part of the canvas itself, no longer editable any ideas there either ?
thanks!
Use AbsoluteLayout
and add touch listener via setOnTouchListener(..)
Then when touch happens, detect the location and add EditText
via
AbsoluteLayout.LayoutParams layoutParams =
new AbsoluteLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, x, y);
absoluteLayout.addView(editText, layoutParams);
精彩评论