我试图从我的xml中将按钮的文本设置为“<<

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

因此,我跳到我的strings.xml并在其中输入它,这显然行不通。
<string name="abc"> <<< </string>

有没有解决方法?

最佳答案

这些是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;

10-02 23:49