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
  • 14,236
  • 32
  • 106
  • 178

2 Answers2

3

Try this :

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("10<sup>x</sup>"));
SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74
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
  • 14,415
  • 11
  • 80
  • 128