請幫忙! 我怎樣才能顯示Android TextView中提出的數字。例如,如果你想顯示一些攝氏度你可以做到這一點:textview.setText(number+"\u2103")
和你的好去,但我找不到辦法做這樣的數字^ anothernumber。Android:顯示x^y
謝謝!
請幫忙! 我怎樣才能顯示Android TextView中提出的數字。例如,如果你想顯示一些攝氏度你可以做到這一點:textview.setText(number+"\u2103")
和你的好去,但我找不到辦法做這樣的數字^ anothernumber。Android:顯示x^y
謝謝!
格式字符串作爲HTML,然後使用HTML標標籤<sup>
:如果你想有一個標使用<sub>
標籤
textView = (TextView)findViewById(R.id.textView);
String text = "x<sup>y</sup>";
textView.setText(Html.fromHtml(text));
同樣。
您可以使用簡單的HTML格式:
String str = number + "<sup>" + anotherNumber + "</sup>";
textView.setText(Html.fromHtml(str), TextView.BufferType.SPANNABLE);
你可以使用TextViews能夠顯示html標記,這應該工作;
textView.setText(android.text.Html.fromHtml("x<sup>y</sup>"));
謝謝的男人。像魅力一樣的工作! –