Xml TextView中的学位符号
我想知道如何在文本视图(android)中为角度创建度符号。有一些问题与此类似,我已经尝试过,但它们似乎不起作用Xml TextView中的学位符号,xml,symbols,degrees,Xml,Symbols,Degrees,我想知道如何在文本视图(android)中为角度创建度符号。有一些问题与此类似,我已经尝试过,但它们似乎不起作用 <TextView android:id="@+id/tv_counter" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:paddingBottom="20dp"
<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" />
XML不使用C样式的转义符,它使用HTML样式的字符实体。试试这个:
android:text="50℃"
正如您在评论中提到的,U+2103不是您想要的,您想要的是:
android:text="50°"
试试这个:
android:text="50℃"
android:text= "50℃"
另请参见代码中的。:
myTextView.setText ( "78" + (char) 0x00B0 );
"OR"
android:text="50℃"
在XML中:
myTextView.setText ( "78" + (char) 0x00B0 );
"OR"
android:text="50℃"
在xml中-如果只需要不带F或C的符号,只需使用:
"\u00B0"
像这样:
android:text="50\u00B0"
是的,这是可行的,但我只是想要一个角度的度符号。@JackTrowbridge,是的,对不起,当你把2103放在例子中时,我以为你想要2103!U+B0是简单的度符号。你是怎么得到这个属性的?我需要适合压力、高度和温度的款式。你能帮忙吗?@RoyDoron有点晚了,不过试试
\x2103代码>用于℃
和&xb0代码>用于°