简体   繁体   中英

Add tick mark (✔) to string.xml

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 pasted the symbol on my string message.

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

将unicode符号"\✓"添加到字符串资源中,或者可以将其作为String对象从代码中使用。

String checkedMark = "\u2713";

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

Check this android's group thread: Supported unicode characters .

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 >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM