How can I display special characters (like –) in the TextView?

后端 未结 4 2050
再見小時候
再見小時候 2020-12-07 01:47

How can I display special characters(like – ") in a TextView?

4条回答
  •  庸人自扰
    2020-12-07 02:41

    I've implemented this solution.

    Activity class:

    textView.setText( getString(R.string.author_quote, "To be or not to be", "Shakespeare") )
    

    strings.xml:

    « %1$s » - %2$s
    

    HTML chars are written directly in strings.xml, no additional Html.fromHtml() is needed. It works fine on all my devices.

提交回复
热议问题