Degrees symbol (as in Degrees Celsius/Fahrenheit) in a TextView

Viewed 54871

Is there a way to include the small circular degrees symbol to a TextView? This would be for temperature readings, as in degrees Celsius or Fahrenheit. I'm wondering if anyone has done this programmatically before.

7 Answers

For showing in XML, if you want to show android:text="32°C" you can use:

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"      
android:text="32&#xb0;C"
android:id="@+id/myTV"></TextView>

To do it programmatically, you can use:

myTV.setText("32" + (char) 0x00B0+"C"); 

For displaying degree symbol in a TextView, you can use from the "& #176;" without any distance. As you can see an example below:

`android:text="10& #176;c" So this command will show you as a 10°c on the screen android.

Related