Strange issue with android:ellipsize=“end”

前端 未结 5 2239
野的像风
野的像风 2021-02-20 14:53

I am using android:ellipsize=\"end\" in android xml file, & surprisingly I am not getting the layout that I want, the 3 dots(...) are showing but after that

5条回答
  •  隐瞒了意图╮
    2021-02-20 15:34

    I was experiencing the same problem when displaying a String containing html formatted text.

    Removing all html tags with myText.replaceAll("\\<.*?>","") solved the problem.

    You can also remove html tags using Html.fromHtml(myText).toString(), but notice that you must use .toString() and not apply the fromHtml output directly to the TextView. If some special characters are html encoded (&, >, <...) you can safely apply again Html.fromHtml() to the final String.

提交回复
热议问题