android - 如何在Android(TextView)中将带有HTML代码的双引号显示为文本?
问题描述
我想在教程应用程序中将 HTML 代码显示为文本
字符串.xml
<string name="p1"><![CDATA[<html>\n<title> Font tag Example </title>\n<body>\n<font face="arial" size="1" color="blue"> WELCOME </font> <br>\n <font size="2" color="cyan"> WELCOME </font> <br>\n <pre>\n This text uses pre tag and preserves nextline and spaces\n </pre>\n </body>\n </html>]]></string>
prog1.xml
<TextView
android:id="@+id/p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:textSize="18sp"
android:text="@string/p1" />
显示不带“”,需要显示带“”双引号
要求这样显示
解决方案
在文本视图中显示双引号(“”)使用这些中的任何一个
"
- \"
这是官方的android网站
https://developer.android.com/guide/topics/resources/string-resource
推荐阅读
- amazon-web-services - 使用 EC2 服务器作为 Nat 网关
- javascript - Axios Config with Auth Header,最佳实践?
- reactjs - 网格中不存在的列的 ag-grid 外部过滤器(服务器端模型)
- flutter - 如何在 FutureBuilder 的 Future.wait 函数中缓存 Future 以在每次状态更改时不重建
- reactjs - 如何从 Axios 获取请求中提取数据?
- php - 如何在 ubuntu 21.04 中下载 php7.2-gd 扩展?
- python - 根据不同维度的条件屏蔽ndarray
- php - PHP XML 尝试按项目 id 将 stock_quantity 添加到主要提要中
- javascript - 赛普拉斯,测试访问被阻止的链接
- android - ProcessException,未找到 gradlew.bat,有时即使在新项目中此文件也包含病毒或可能不需要的软件