所以我试图将上标/下标添加到 TextView,基本上是试图让分数显示为1 / 2。不知道我哪里出错了,而且我是 Android 新手,所以感谢您的帮助。谢谢!
SpannableStringBuilder numSpan = new SpannableStringBuilder(String.valueOf(num));
SpannableStringBuilder denSpan = new SpannableStringBuilder(String.valueOf(den));
numSpan.setSpan(new SuperscriptSpan(), 0, numSpan.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
denSpan.setSpan(new SubscriptSpan(), 0, denSpan.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
outputText.setText(numSpan + "/" + denSpan, TextView.BufferType.SPANNABLE););