开发者

Add tick mark (✔) to string.xml

开发者 https://www.devze.com 2023-02-23 06:11 出处:网络
I am adding tick mark (✔) on a string message on the strings.xml, but I am gettinga \"box\" instead of the tick mark when I am display that on the mobile device.

I am adding tick mark (✔) on a string message on the strings.xml, but I am getting a "box" instead of the tick mark when I am display that on the mobile device.

I have directly pa开发者_如何学Gosted the symbol on my string message.

Is there any way we can handle that? Do we need to use an unicode value?


Add unicode symbol "\u2713" to your string resource or you can use it from code as String object.

String checkedMark = "\u2713";


Try using ✓ as the string value, then use Html.fromHtml to parse the string.


Instead of using an unicode value, I would also recommend you to use a Drawable inside a TextView. For example, you can add the drawable to the TextView using android:drawableRight.


You could use Html.fromHtml to get a Spannable text and set it to your text view. In string.xml you will specify the corresponding HTML entity such as >

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号