简体   繁体   中英

registered trademark Ⓡ symbol superscript issue in Nexus devices

I am working on an application which has lots of Ⓡ in its navigation drawer and action bar. The superscript tag is working fine for all the Nexus devices (tested on galaxy s3, s4 and s5). I have tried doing below sample:

This is a dummy <sup><small>&reg;</small></sup>

But when I tested it on Nexus S and Nexus 5 the Ⓡ symbol is not appearing properly. After searching on Google I found that there is some problem with the Nexus devices reading superscript tag.

I am stuck with this issue.

Try the SuperscriptSpan like following, replace the startIndex and endIndex with the position of your trademark character. Be careful with the size of the text, you may need some density independent size here probably to make it work on all screens.

    Spannable span = new SpannableString(title);
    span.setSpan(new TextAppearanceSpan(null, 0, 60, null, null), (int)startIndex, (int)endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    span.setSpan(new SuperscriptSpan(), (int)startIndex, (int)endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    textView.setText(span);

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