I have a multi-line TextView
. Is there a way to get the x coordinate of the pixel to the left of a character e.g. the 3rd character? In my case it will always be the 3rd character, but a general solution would be nicer.
I have the y coordinate of the pixel just above the character using:
Layout textViewLay = mTextView.getLayout();
int posY = textViewLay.getLineTop(0);
but the x coordinate has me stumped. Any ideas? I'm probably missing something really simple.
Try to use this code:
Rect bounds = new Rect();
Paint tpaint = textView.getPaint();
tpaint.getTextBounds(text,0,2,bounds);
int height = bounds.height();
int width = bounds.width();
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments