1

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

BenMorel
  • 34,448
  • 50
  • 182
  • 322

4 Answers4

2

html code for superscript registered trademark symbol to show like Google®

 <string name=company_name">Company name<sup>&#174;</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()

0

Use the html code for "registered trade mark sign", &#174

to display something like: Company name ®

Two ways to achieve this:

1) add into your strings.xml file

<string name=company_name">Company name &#174;</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 &#174;"));
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
0

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 ® &#174;

For displaying the symbol in superscript you can use the html tag <sup></sup>

Community
  • 1
  • 1
lbenini
  • 417
  • 7
  • 11
0

if you actually have the code I think you can do it as follows:

((TextView)findViewById(R.id.text)).setText(Html.fromHtml("<sup>&#174;</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

Miquel Coll
  • 759
  • 15
  • 49