0

I need to display s.th. like 10ˣ on a android button or textview.

So I added it to the strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="a10x">10ˣ</string>
</resources>

the problem is, then I start the app I just see the 10 and the x is missing.

How to fix this?

gurehbgui
  • 13,218
  • 29
  • 100
  • 167

2 Answers2

3

Try this :

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("10<sup>x</sup>"));
SweetWisher ツ
  • 7,288
  • 2
  • 28
  • 70
1
<string name="10x">10ˣ</string> 

Please change this variable name to something like start with alphabets. Because this will produce error in R.java file. public static final int 10*=0x7f04009a; see here, Your variable will create a variable in R.java like this. This is wrong in java naming conversion. I hope this is only problem. Otherwise use some codes like &#160, this is for single space.

I hope this will help you.

Gunaseelan
  • 12,697
  • 10
  • 74
  • 118