As in the images shown below, is it possible to write code to write "to the power" in 开发者_如何学JAVAAndroid or Java?
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.
精彩评论