How to get cursor position (x,y) in EditText android -
how cursor position x,y in edittext
in android? (where x line# , y column#)
int pos = edittext.getselectionstart(); layout layout = edittext.getlayout(); int line = layout.getlineforoffset(pos); int baseline = layout.getlinebaseline(line); int ascent = layout.getlineascent(line); float x = layout.getprimaryhorizontal(pos); float y = baseline + ascent;
and there x, y positions in pixels of cursor.
Comments
Post a Comment