开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜