如果检测TextView的跨越2线 [英] Detect if TextView spans over 2 lines
问题描述
我不知道是否有发现任何方式或者如果字符串被安装到一个文本视图达到画面的结束,因此换线,或者如果一个TextView跨越了两行?
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?
我想知道这个,所以我可以增加一些textviews之间的利润率,如果一个TextView跨越了2行,我当然要动态地做到这一点。
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.
推荐答案
的TextView
支持 getLineCount()
- 请参阅<一href=\"https://developer.android.com/reference/android/widget/TextView.html#getLineCount%28%29\">docs小心,因为你可能需要检查的观点得到了第一个绘制。
TextView
supports getLineCount()
- See docs careful as you may need to check if the view has been drawn first.
这篇关于如果检测TextView的跨越2线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!