Android 中的字符串下标和上标 [英] Subscript and Superscript a String in Android

查看:22
本文介绍了Android 中的字符串下标和上标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何打印带有下标或上标的字符串?你能在没有外部库的情况下做到这一点吗?我希望它显示在 Android 的 TextView 中.

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.

推荐答案

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("X<sup>2</sup>"));

常见任务以及如何在 Android 中执行这些任务

这篇关于Android 中的字符串下标和上标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆