我希望避免在字符串的特定部分断行。
假设我们有以下字符串:
Speed (m/s)
理想情况下要么不跳行并且将整个字符串放在一行中,要么如果需要跳行,则应该以这种方式:
Speed
(m/s)
我想要避免的是这样的事情: What I want to avoid are thing like this:
Speed (m/
s)
有什么想法吗?
TextView
。类似问题的链接 - YX1990尝试这个(只是一个想法,未经测试):
View.getMeasuredWidth()
计算 TextView
的宽度。Paint.measureText()
计算 String
的宽度。