android - 在 Android 设备中运行应用程序时字符串格式不起作用
问题描述
我有一个像这样格式化的字符串。
<string name="instructions" formatted="true">
Follow these instructions.
<br/><br/>
1. Step 1.
<br/><br/>
2. Step 2.
<br/><br/>
3. Step 3.
</string>
在设计器预览中,它看起来像这样。
当我在模拟器或真正的 Android 设备中运行它时,它看起来像这样。
如何让真实设备看起来像设计器预览?
解决方案
使用\n
而不是<br/>
像下面这样:
<string name="instructions" formatted="true">
Follow these instructions.
\n\n
1. Step 1.
\n\n
2. Step 2.
\n\n
3. Step 3.
</string>
推荐阅读
- eclipse-plugin - SWT DirectoryDialog - 获取最后选择的文件夹
- javascript - 如何在 Angular 8 的 div 标签内注入整个 html 文件?
- laravel - 我如何让 Vagrant 找到最新的(宅基地)盒子
- python-3.x - Pandas 在对象列上变换
- python - 如何在python中运行服务器
- sybase - 用于匹配字符串之间的模式的 Sybase like 子句
- rust - 有没有办法在 fsanitize 中断/崩溃时捕获子进程标准输出?
- c++ - 如何将 ON_CALL 的默认返回值设置为 gmock 的 const 方法?
- php - laravel echo 是否支持媒体流数据
- swift - 在命令行应用程序中使用 Swift 中的 URLSession POST 请求