Detect if TextView spans over 2 lines

旧时模样 提交于 2020-01-13 07:36:06

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/13444060/detect-if-textview-spans-over-2-lines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!