无法将按钮文字设置为“<<<<" [英] Cannot set button text to "<<<"

查看:104
本文介绍了无法将按钮文字设置为“<<<<"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将按钮的文字设置为<<<<从我的xml但我得到一个错误:(20)解析XML时出错:格式不正确(无效令牌)

I'm trying to set the text of a button to "<<<" from my xml but I get an "Error:(20) Error parsing XML: not well-formed (invalid token)"

    <Button
        android:id="@+id/test"
        android:text="<<<"
        android:layout_width="wrap_content"
        android:layout_height="match_parent" />

所以我跳到我的strings.xml进入那里,这显然不起作用。

So I jumped over to my strings.xml to enter it in there and that clearly won't work.

<string name="abc"> <<< </string>

这是否有解决方法?

推荐答案

这些是html实体,也适用于Android工作室:

These are html entities, works in android studio as well:

> 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;

这篇关于无法将按钮文字设置为“&lt;&lt;&lt;&lt;&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆