Android :
SpannableStringBuilder ssb = new SpannableStringBuilder(content);ssb.replace(start, start + sub.length(), "Save6");
Parcel parcel = Parcel.obtain();
parcel.writeInt(6);
int sixPosition = ssb.toString().indexOf("6");
ssb.setSpan(new SubscriptSpan(parcel), sixPosition, sixPosition + 1, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
parcel.recycle();
contentTV.setText(ssb);
Html:
上角标
This text contains
<sup>superscript</sup>
下角标
This text contains
<sub>subscript</sub>