在項(xiàng)目中,有時(shí)候在一些控件(如Button、TextView)中要添加一些符號(hào),如下圖所示:

這個(gè)時(shí)候可以使用圖片的方式來顯示,不過這些可以直接使用Unicode碼就直接顯示出來了。
4個(gè)箭頭圖標(biāo)的代碼如下:
<RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center_horizontal" > <Button android:id="@+id/scroll_left" android:layout_width="40dip" android:layout_height="40dip" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:text="@string/left_arrow" /> <Button android:id="@+id/scroll_up" android:layout_width="40dip" android:layout_height="40dip" android:layout_alignParentTop="true" android:layout_toRightOf="@id/scroll_left" android:text="@string/up_arrow" /> <Button android:id="@+id/scroll_down" android:layout_width="40dip" android:layout_height="40dip" android:layout_below="@id/scroll_up" android:layout_toRightOf="@id/scroll_left" android:text="@string/down_arrow" /> <Button android:id="@+id/scroll_right" android:layout_width="40dip" android:layout_height="40dip" android:layout_centerVertical="true" android:layout_toRightOf="@id/scroll_down" android:text="@string/right_arrow" /> </RelativeLayout>
皇冠和音樂圖標(biāo)代碼如下:
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/music" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/crown" /> </LinearLayout>
上面的幾個(gè)字符串值為:
<string name="music">/u265A</string><string name="crown">/u266B</string><string name="left_arrow">/u2190</string><string name="up_arrow">/u2191</string><string name="down_arrow">/u2193</string><string name="right_arrow">/u2192</string>
從網(wǎng)上找到了部分關(guān)于特殊符號(hào)的Unicode碼值,記錄下來,以備后用,如下所示:
用Android的string.xml中使用Unicode表示符號(hào)的話,就使用下面的JS相關(guān)的Unicode值即可
⇠ 箭頭類
| 符號(hào) | UNICODE | 符號(hào) | UNICODE | ||||
|---|---|---|---|---|---|---|---|
| HTML | JS | CSS | HTML | JS | CSS | ||
| ⇠ | ⇠ | /u21E0 | /21E0 | ⇢ | ⇢ | /u21E2 | /21E2 |
| ⇡ | ⇡ | /u21E1 | /21E1 | ⇣ | ⇣ | /u21E3 | /21E3 |
| ↞ | ↞ | /u219E | /219E | ↠ | ↠ | /u21A0 | /21A0 |
| ↟ | ↟ | /u219F | /219F | ↡ | ↡ | /u21A1 | /21A1 |
| ← | ← | /u2190 | /2190 | → | → | /u2192 | /2192 |
| ↑ | ↑ | /u2191 | /2191 | ↓ | ↓ | /u2193 | /2193 |
| ↔ | ↔ | /u2194 | /2194 | ↕ | ↕ | /u2195 | /2195 |
| ⇄ | ⇄ | /u21C4 | /21C4 | ⇅ | ⇅ | /u21C5 | /21C5 |
| ↢ | ↢ | /u21A2 | /21A2 | ↣ | ↣ | /u21A3 | /21A3 |
| ⇞ | ⇞ | /u21DE | /21DE | ⇟ | ⇟ | /u21DF | /21DF |
| ↫ | ↫ | /u21AB | /21AB | ↬ | ↬ | /u21AC | /21AC |
| ⇜ | ⇜ | /u21DC | /21DC | ⇝ | ⇝ | /u21DD | /21DD |
| ↚ | ↚ | /u219A | /219A | ↛ | ↛ | /u219B | /219B |
| ↮ | ↮ | /u21AE | /21AE | ↭ | ↭ | /u21AD | /21AD |
| ⇦ | ⇦ | /u21E6 | /21E6 | ⇨ | ⇨ | /u21E8 | /21E8 |
| ⇧ | ⇧ | /u21E7 | /21E7 | ⇩ | ⇩ | /u21E9 | /21E9 |
| ▲ | ▲ | /u25B2 | /25B2 | ► | ► | /u25BA | /25BA |
| 主站蜘蛛池模板: 永春县| 新乐市| 吴桥县| 铜梁县| 同仁县| 兴隆县| 卢龙县| 五台县| 乌鲁木齐县| 东辽县| 宁德市| 甘洛县| 保靖县| 张家港市| 彭泽县| 兴义市| 秦安县| 扶绥县| 洛阳市| 无棣县| 安新县| 福泉市| 浦城县| 定西市| 周至县| 宿州市| 朔州市| 呈贡县| 宽城| 玉门市| 广州市| 商河县| 兖州市| 秀山| 阿坝| 新源县| 边坝县| 收藏| 宁明县| 叶城县| 遂川县| | |||||||