开始时如何在 android TextView 中写入 `@` 符号
How to write `@` symbol in android TextView at starting
我想在 TextView
中写以 @
符号开头的文本。但是,当我将它作为硬编码和使用字符串资源在这两个地方编写时,错误显示 missing /
。当我在 @
之前输入一些字符时,它工作正常。但是,我想写在开头。如何实现?
按照错误提示写“\@”即可;)(特殊字符需要用“\”转义)
在 String.xml 中添加 Unicode 字符,如
<string name="character">\u0040 character</string>
将此添加到您的文本视图中,例如:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/character"/>
此处\u0040表示'@'符号。
这样使用\@
<string name="character">\@ character</string>
或者您可以使用 Unicode 字符 [=12=]40
我想在 TextView
中写以 @
符号开头的文本。但是,当我将它作为硬编码和使用字符串资源在这两个地方编写时,错误显示 missing /
。当我在 @
之前输入一些字符时,它工作正常。但是,我想写在开头。如何实现?
按照错误提示写“\@”即可;)(特殊字符需要用“\”转义)
在 String.xml 中添加 Unicode 字符,如
<string name="character">\u0040 character</string>
将此添加到您的文本视图中,例如:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/character"/>
此处\u0040表示'@'符号。
这样使用\@
<string name="character">\@ character</string>
或者您可以使用 Unicode 字符 [=12=]40