Android 常用占位符

2021-06-19  本文已影响0人  Kevin_小飞象

常用占位符

符号 HTML JS CSS
&#8592 \u2190 \2190
&#8594 \u2192 \2192
&#8593 \u2191 \2191
&#8595 \u2193 \2193
&#8644 \u21C4 \21C4
&#8645 \u21C5 \21C5
&#9733 \u2605 \2605
$ &#36 \u0024 \0024
¥ &#165 \u00A5 \00A5
½ &#189 \u00BD \00BD
% &#37 \u0025 \0025
&#8240 \u2030 \266A
< &#60 \u003C \003C
> &#62 \u003E \003E
&#9834 \u266A \2605
® &#174 \u00AE \00AE
© &#169 \u00A9 \00A9
&#8471 \u2117 \2117
« &#171 \u00AB \00AB
» &#187 \u00BB \00BB
&#8220 \u201C \201C
&#8221 \u201D \201D
& &#38 \u0026 \0026
@ &#64 \u0040 \0040
&#8451 \u2103 \2103
° &#176 \u00B0 \00B0
&#8211 \u2013 \2013
&#8212 \u2014 \2014
&#8230 \u2026 \2026
&#8764 \u223C \223C
&#8800 \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> 

栗子

实现不同汉字字数对齐

- 空格:&#160;(普通的英文半角空格但不换行)
- 窄空格:&#8201;
- &#12288;(中文全角空格 (一个中文宽度))
- &#8194;(半个中文宽度,但两个空格比一个中文略大)
- &#8195;(一个中文宽度,但用起来会比中文字宽一点点)
- \u3000\u3000(首行缩进)
- \u3000(全角空格(中文符号))
- \u0020(半角空格(英文符号))
- &#8230;(省略号)
<?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="&#8195;用户名:"
        android:background="#54ff0000"
        android:padding="8dp"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="&#8195;&#8195;密码:"
        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>
上一篇 下一篇

猜你喜欢

热点阅读