I have an array of models each representing a word in a text. It looks like this:
ArrayList text;
class Word {
public String name;
public bo
I would suggest you use one TextView
as this is a much more efficient UI. When there is a request for a ViewGroup
to measure all of it's children, it is much faster to measure only one than a couple of thousand.
I have found a nice library you may try to use here. It uses getOffsetForPostion method added to TextView
in API level 14.
public int getOffsetForPosition (float x, float y)
Added in API level 14 Get the character offset closest to the specified absolute position. A typical use case is to pass the result of getX() and getY() to this method.
Parameters x The horizontal absolute position of a point on screen y The vertical absolute position of a point on screen Returns the character offset for the character whose position is closest to the specified position. Returns -1 if there is no layout.