引用XML数组(Android)中的XML字符串

前端之家收集整理的这篇文章主要介绍了引用XML数组(Android)中的XML字符串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在arrays.xml中
<string-array name="my_items">
  <item>My item 1</item>
  <item>My item 2</item>
  <item>My item 3</item>
</string-array>

在strings.xml中

<resources>
  <string name="item1">My item 1</string>
  <string name="item2">My item 2</string>
  <string name="item3">My item 3</string>
</resources>

我想从strings.xml中引用数组“我的项目1”中的字符串。我怎么做?

哦,是的,这就是我的意思。这是我怎么做的
<string-array name="my_items">
  <item>@string/item1</item>
  <item>@string/item2</item>
  <item>@string/item3</item>
</string-array>

它在Android 1.6中正确解析

原文链接:https://www.f2er.com/xml/293240.html

猜你在找的XML相关文章