Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if TextView spans over 2 lines

I wonder if there are any ways to detect either if string to be fitted into a text view reaches the end of screen and therefore change line, or if a textview spans over 2 lines?

I want to know this so I can increase margins between some textviews if a textview spans over 2 lines, of course I want to do this dynamically.

like image 557
Robert Avatar asked Nov 18 '12 20:11

Robert


Video Answer


1 Answers

TextView supports getLineCount() - See docs careful as you may need to check if the view has been drawn first.

like image 184
Chris.Jenkins Avatar answered Oct 18 '22 06:10

Chris.Jenkins