无法将按钮文本设置为“<<<”
Cannot set button text to "<<<"
我正在尝试将 xml 中的按钮文本设置为“<<<”,但我得到 "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 那里输入它,但这显然行不通。
<string name="abc"> <<< </string>
有解决办法吗?
这些是 html 个实体,也在 android 工作室中工作:
> can be replaced with >
< can be replaced with <
" can be replaced with ", “ or ”
' can be replaced with ', ‘ or ’
} can be replaced with }
& can be replaced with &
space can be replaced with  
对>
使用>
,<
使用<
,&
使用&
,[='
17=] , "
对于 "
您可以使用
< (less-than) < or <
> (greater-than) > or >
& (ampersand) & or &
' (apostrophe or single quote) ' or '
" (double-quote) " or "
请查看这些链接:
Using Special Characters in XML
Whosebug - escaping special characters like & in android xml
我正在尝试将 xml 中的按钮文本设置为“<<<”,但我得到 "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 那里输入它,但这显然行不通。
<string name="abc"> <<< </string>
有解决办法吗?
这些是 html 个实体,也在 android 工作室中工作:
> can be replaced with >
< can be replaced with <
" can be replaced with ", “ or ”
' can be replaced with ', ‘ or ’
} can be replaced with }
& can be replaced with &
space can be replaced with  
对>
使用>
,<
使用<
,&
使用&
,[='
17=] , "
对于 "
您可以使用
< (less-than) < or <
> (greater-than) > or >
& (ampersand) & or &
' (apostrophe or single quote) ' or '
" (double-quote) " or "
请查看这些链接:
Using Special Characters in XML
Whosebug - escaping special characters like & in android xml