Android String Resource Superscript

前端 未结 5 1230
无人共我
无人共我 2020-12-06 22:25

I have a string resource file, which I want to pull strings from and I want one of the strings to have some superscript in it.

From http://developer.android.com/gui

相关标签:
5条回答
  • 2020-12-06 22:54

    <string name="sup_string"> a<sup><small>n</small></sup> b </string>

    an b

    this worked for me.

    0 讨论(0)
  • 2020-12-06 23:00

    You can use X\u00B2 to create X^2 in xml directly

    0 讨论(0)
  • 2020-12-06 23:07

    I am using this trick: In string resource:

    <string name="text1">x!sup@2!/sup@</string>
    

    Then in activity:

    text1.setText(Html.fromHtml(getString(R.string.text1).replace("!", "<").replace("@", ">")));
    

    this trick is working.

    0 讨论(0)
  • 2020-12-06 23:09

    You can escape like this:

    <string name="acceleration"><![CDATA[%1$f m.s<sup><small>-2</small></sup>]]></string>
    
    0 讨论(0)
  • 2020-12-06 23:09

    Android String Resource Superscript and Subscript for letters

    You can copy and paste any of these Superscripts and Subscripts directly into your Android String Resource.

    Example:

        <string name="word_with_superscript" translatable="false">Trademark ᵀᴹ</string>
    

    Result:Trademark ᵀᴹ

    Superscript and Subscript letters

    Superscript capital ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ

    Superscript minuscule ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ

    Subscript minuscule ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ

    0 讨论(0)
提交回复
热议问题