Android TextView 的下标被剪掉 [英] Android TextView's subscript being clipped off
本文介绍了Android TextView 的下标被剪掉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即使我对 TextView 使用 android:layout_height="wrap_content"
,Android TextView 也会剪掉我的文本下标(见下图).是否有解决方法/解决方法?
The Android TextView clips off my text subscripts (see image below) even when I use android:layout_height="wrap_content"
for the TextView.
Is there a fix/work-around for this?
P/S:上标工作正常
注意: 填充不起作用.
- 我什至尝试添加 50dip 的填充,但没有帮助.
- 我可以使用绝对高度,例如 50dip,但是当我需要文字环绕时,这会搞砸一切.
- I tried even adding a padding of 50dip but it did not help.
- I can use an absolute height such as 50dip but that messes everything up when I need text to wrap around.
示例代码:
mtTextView.setText(Html.fromHtml("HC03"));
mtTextView.setText(Html.fromHtml("HC0<sub>3</sub>"));
推荐答案
这个解决方案 为我工作.
浏览器渲染时,上标文本通常会变小,这似乎不会在这里发生,因此您可以通过这样做来复制(并解决此问题):
Superscripted text is usually made smaller when the browser renders it, that doesn't seem to happen here so you can replicate that (and solve this problem) by doing this:
someTextView.setText(Html.fromHtml("Some text<sup><small>1</small></sup>"));
这篇关于Android TextView 的下标被剪掉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文