How can you print a string with a subscript or superscript? Can you do this without an external library? I want this to display in a TextView
in Android.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
If you want to set the superscript from string.xml file try this:
string resource:
if you want the superscript to be smaller:
Code:
I found this article on how to use a
Spannable
or in a string resource file:<sup>
or<sub>
for superscript and subscript, respectively.X2
It bit late but following just work fine, use superscript as special character, I used spacial char here.
In the code just put this "\u00B2" Like this:
textView.setText("X\u00B2");
(or) From String Resource File: