我希望能够从strings.xml文件中的另一个字符串引用一个字符串,就像下面这样(特别注意"message_text"字符串内容末尾):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="button_text">Add item</string>
<string name="message_text">You don't have any items yet! Add one by pressing the \'@string/button_text\' button.</string>
</resources>
我尝试了上述语法,但是文本会将"@string/button_text"打印成明文。这不是我想要的。我希望消息文本打印为“您还没有任何项目!按‘添加项目’按钮添加一个。”。
是否有已知的方法可以实现我的需求?
原因: 我的应用程序有一个项目列表,但是当该列表为空时,我会显示一个“@android:id/empty” TextView。该TextView中的文本旨在告知用户如何添加新项目。我想使我的布局防止更改(是的,我就是那个傻瓜 :-))。