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

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -