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
There is a Unicode symbol for Celsius degrees that you can use in Java: \u2103
. For Fahrenheit you can use \u2109
.
I have confirmed this works on Android Nexus S running Android version 2.3.6.
Example code:
temperatureValue.setText((result) + " \u2109");

- 5,146
- 1
- 21
- 32

- 5,029
- 2
- 41
- 41
-
3Yes! It did work. I tried it on a 1.5 emulator and a 2.2 emulator, and tv.setText("\u2103") worked no problem. – Aurora Jul 22 '10 at 19:46
-
28If you just want the degree symbol without the C or F, use `\u00B0`. – Courtney Pattison Feb 14 '15 at 14:16
-
How can i use this in kotlin ? – Kanagalingam Aug 08 '19 at 10:44
-
Concatenate strings like for example it is shown in this comment: https://stackoverflow.com/a/44188301/371388 But instead of `"Hello"` and `"World"`, you can have for example `"Hello"` and `"\u2109"` for the intended unicode character – Luis Miguel Serrano Aug 09 '19 at 17:14
-
I'm looking for a table or dictionary. :) – Alston Aug 16 '19 at 12:48
If Someone wants just the little circle sign without the letter, he can use:
\u00B0
Source: Unicode Character 'DEGREE SIGN'

- 4,996
- 1
- 31
- 37
in Activity for Celsius
tempValue.setText((resultemp) + " \u2103");
for Fahrenheit
tempValue.setText((resultemp) + " \u2109");
for Kelvin
tempValue.setText((resultemp) + " \u212A");
for Romer
tempValue.setText((resultemp) + " \u00B0R");
In xml.file for Celsius
android:text="\u2103"
for Fahrenheit
android:text="\u2109"
for Kelvin
android:text="\u212A"
for Romer
android:text="\u00B0R"

- 366
- 2
- 8
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\u00B0"/>
If sign is not visible on android studio layout preview, you need to add
xmlns:tools="http://schemas.android.com/tools"
to the root xml element.

- 5,701
- 2
- 34
- 39
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°C"
android:id="@+id/myTV"></TextView>
To do it programmatically, you can use:
myTV.setText("32" + (char) 0x00B0+"C");

- 369
- 4
- 9
If you need only the degree (o) circle symbol you can copy below code.
char tmp = 0x00B0;
temperature.setText("60"+tmp);
Hope it helps :)

- 619
- 8
- 15
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.

- 1
- 3