我有一个 textView,我将 s 字符串粘贴为文本,其中有一些“双引号字符”我如何转义这些字符。
最佳答案
反斜杠双引号在 XML 布局中不起作用。您应该使用 HTML 代码 (quot),如下所示:
<TextView android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Here goes my "escaped" text!" />
上面的代码将显示一个包含以下内容的 TextView:
Here goes my "escaped" text!
XML 有 5 of these predifined entities :
" "
& &
' '
< <
> >
关于android - 在 TextView 的 Text 中转义 "",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7118221/