开发者

How to write the "to the power" and some text like as shown in Java or Android?

As in the images shown below, is it possible to write code to write "to the power" in 开发者_如何学JAVAAndroid or Java?

How to write the "to the power" and some text like as shown in Java or Android?

How to write the "to the power" and some text like as shown in Java or Android?


Something like:

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

According to Android documentation on their FAQ, you can always do this using a string resource, but if you do it on the fly you must make sure the TextView is using Spannable storage (always true if it's an EditText for example).

See Selecting, Highlighting, or Styling Portions of Text in the Android Common Tasks.


You can write HTML Code to show something like this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜