Android 常用占位符
2021-06-19 本文已影响0人
Kevin_小飞象
常用占位符
符号 | HTML | JS | CSS |
---|---|---|---|
← | ← | \u2190 | \2190 |
→ | → | \u2192 | \2192 |
↑ | ↑ | \u2191 | \2191 |
↓ | ↓ | \u2193 | \2193 |
⇄ | ⇄ | \u21C4 | \21C4 |
⇅ | ⇅ | \u21C5 | \21C5 |
★ | ★ | \u2605 | \2605 |
$ | $ | \u0024 | \0024 |
¥ | ¥ | \u00A5 | \00A5 |
½ | ½ | \u00BD | \00BD |
% | % | \u0025 | \0025 |
‰ | ‰ | \u2030 | \266A |
< | < | \u003C | \003C |
> | > | \u003E | \003E |
♪ | ♪ | \u266A | \2605 |
® | ® | \u00AE | \00AE |
© | © | \u00A9 | \00A9 |
℗ | ℗ | \u2117 | \2117 |
« | « | \u00AB | \00AB |
» | » | \u00BB | \00BB |
“ | “ | \u201C | \201C |
” | ” | \u201D | \201D |
& | & | \u0026 | \0026 |
@ | @ | \u0040 | \0040 |
℃ | ℃ | \u2103 | \2103 |
° | ° | \u00B0 | \00B0 |
– | – | \u2013 | \2013 |
— | — | \u2014 | \2014 |
… | … | \u2026 | \2026 |
∼ | ∼ | \u223C | \223C |
≠ | ≠ | \u2260 | \2260 |
使用
用 Android 的 string.xml 中使用 Unicode 表示符号的话,就使用下面的 JS 相关的 Unicode 值。
<string name="left_arrow">\u2190</string>
<string name="up_arrow">\u2191</string>
<string name="down_arrow">\u2193</string>
<string name="right_arrow">\u2192</string>
栗子
实现不同汉字字数对齐
- 空格: (普通的英文半角空格但不换行)
- 窄空格: 
-  (中文全角空格 (一个中文宽度))
-  (半个中文宽度,但两个空格比一个中文略大)
-  (一个中文宽度,但用起来会比中文字宽一点点)
- \u3000\u3000(首行缩进)
- \u3000(全角空格(中文符号))
- \u0020(半角空格(英文符号))
- …(省略号)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 用户名:"
android:background="#54ff0000"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="  密码:"
android:background="#5400ff00"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="电子邮箱:"
android:background="#540000ff"
android:padding="8dp"/>
</LinearLayout>