degree symbol in TextView

Jack Trowbridge picture Jack Trowbridge · Jan 8, 2012 · Viewed 13k times · Source

I want to know how to make a degree symbol for an angle in a Text View (android). There are a few questions similar to this, I have tried them but they don't seem to work.

<TextView
    android:id="@+id/tv_counter"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:paddingBottom="20dp"

    android:text="..."

    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="80dp"
    android:textColor="#FFA500" />

Answer

Ned Batchelder picture Ned Batchelder · Jan 8, 2012

XML doesn't use C-style escapes, it uses HTML-style character entities. Try this:

android:text="50&#x2103;"

As you mention in the comment, U+2103 isn't what you want, you want this:

android:text="50&#xb0;"