Android TextView's subscript being clipped off

前端 未结 9 2387
粉色の甜心
粉色の甜心 2020-12-28 14:41

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

9条回答
  •  粉色の甜心
    2020-12-28 15:26

    I had the same issue, so after reading the posts, I found this to be working.

    Example : H2O
    simply use :

    textView.setText(Html.fromHtml("H2O"),BufferType.SPANNABLE);
    

    BufferType.SPANNABLE is important as it will tell textview to consider the superscript span.

    If you are using custom tag handler for HTML you can also use it like this:

     textView.setText(Html.fromHtml(data, null, new CustomHtmlTagHandler(),BufferType.SPANNABLE);
    

    Hope it helps someone looking for same problem.

提交回复
热议问题