无法将按钮文本设置为“<<<”。

4
我试图从我的xml文件中将按钮的文本设置为"<<<",但我收到了一个“错误:(20)错误解析XML:不符合格式(无效标记)” 的错误信息。
    <Button
        android:id="@+id/test"
        android:text="<<<"
        android:layout_width="wrap_content"
        android:layout_height="match_parent" />

所以我跳转到我的strings.xml文件中输入,但这显然行不通。
<string name="abc"> <<< </string>

这个问题有没有解决方法?
3个回答

7

这些是 HTML 实体,同样适用于 Android Studio:

> can be replaced with &gt;
< can be replaced with &lt;
" can be replaced with &quot;, &ldquo; or &rdquo;
' can be replaced with &apos;, &lsquo; or &rsquo;
} can be replaced with &#125;
& can be replaced with &amp;
space can be replaced with &#160;

3

3

使用&gt;表示大于号>,使用&lt;表示小于号<,使用&amp;表示&符号&,使用&apos;表示单引号',使用&quot;表示双引号"


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接