I´m trying to do a simple buttom that include a text(company name)+R(registered symbol) but I also need that the R will be superscript of the text, something like this: http://www.geofonica.com/graphics/gf-logo.gif
-
1And what is your problem? – Justin Jasmann May 21 '14 at 15:10
-
There is no unicode value for that registered symbol in superscript. – Richard Le Mesurier May 21 '14 at 15:11
-
yes I can´t make registered symbol superscript inside the buttom – May 21 '14 at 15:12
-
Refer this: http://stackoverflow.com/questions/4522337/unicode-characters-not-displayed-in-textview-settext – Umit Kaya May 21 '14 at 15:15
4 Answers
html code for superscript registered trademark symbol to show like Google®
<string name=company_name">Company name<sup>®</sup></string>
and in your text view
<TextView
android:id="@+id/txt_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/company_name"/>
And then use the method Html.fromHtml()

- 628
- 4
- 17
Use the html code for "registered trade mark sign", ®
to display something like: Company name ®
Two ways to achieve this:
1) add into your strings.xml
file
<string name=company_name">Company name ®</string>
and load that string to your layout
<TextView
android:id="@+id/txt_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/company_name"/>
2) Use the method Html.fromHtml()
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("Company name ®"));

- 124,308
- 23
- 334
- 268
Using Html.fromHtml
you can display html (at least a subset) in TextView, Button etc...
A good example can be found at android button text and html
For the registered symbol you can encode it as html entity ® ®
For displaying the symbol in superscript you can use the html tag <sup></sup>
if you actually have the code I think you can do it as follows:
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("<sup>®</sup>"));
Otherwise, I think it might be acceptable to just assume a superscript R.
((TextView)findViewById(R.id.text)).setText(Html.fromHtml("<sup>R</sup>"));
Hope it helps.
Source: http://developer.android.com/guide/faq/commontasks.html#selectingtext

- 759
- 15
- 49