android - 是否可以将包含 %1$s 或 @string/some_string 的字符串资源包含在布局 XML 中
问题描述
在 Android Studio 中,有没有办法在布局 XML 文件中使用%1$s
或嵌套字符串资源?strings.xml
例如:
字符串.xml
<string name="help_menu_title">Help</string>
<string name="help_tooltip">Please see \'%1$s\' menu for more information.</string>
my_layout.xml
<textview
text="@string/help_tooltip" />
或者
字符串.xml
<string name="help_menu_title">Help</string>
<string name="help_tooltip">Please see \'@string/help_menu_title\' menu for more information.</string>
my_layout.xml
<textview
text="@string/help_tooltip" />
还是必须textview
重新分配文本String.format
以包含“嵌套”字符串?
解决方案
推荐阅读
- appium - driver.navigate.back() 在 iOS v12 中不起作用
- bash - 如何从字符串评估日期
- python-3.x - 在 python 3 中更改硬编码值
- python - 字典未根据完整字典更新,但仅更新最终元素
- html - 如何垂直居中左侧的徽标和标题右侧的导航?
- python - Flask Sqlalchemy 比较两个相关表的两个日期
- excel - 列表框未显示使用 Listbox.List 方法填充其中的值
- php - 如何使用准备好的 stmt pdo 提供分页参数?
- c# - 无法加载文件或程序集“Microsoft.CodeDom.Providers.DotNetCompilerPlatform 或其依赖项之一。访问被拒绝
- php - MySQL - 如何连接加载数据语句?