gpt4 book ai didi

android - 在 TextView 的 Text 中转义 ""

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:14:00 25 4
gpt4 key购买 nike

我有一个 textView,我将 s 字符串粘贴为文本,其中有一些“双引号字符”我如何转义这些字符。

最佳答案

反斜杠双引号在 XML 布局中不起作用。您应该使用 HTML 代码 (quot),如下所示:

<TextView android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Here goes my &quot;escaped&quot; text!" />

上面的代码将显示一个包含以下内容的 TextView:

Here goes my "escaped" text!

XML 有 5 of these predifined entities :

&quot;   "
&amp; &
&apos; '
&lt; <
&gt; >

关于android - 在 TextView 的 Text 中转义 "",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7118221/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com