开发者

Referencing an XML string in an XML Array (Android)

开发者 https://www.devze.com 2022-12-31 00:53 出处:网络
in arrays.xml <string-array name=\"my_items\"> <item>My item 1&开发者_Go百科lt;/item>

in arrays.xml

<string-array name="my_items">
  <item>My item 1&开发者_Go百科lt;/item>
  <item>My item 2</item>
  <item>My item 3</item>
</string-array>

in 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>

I would like to reference the string in the array "My item 1" from strings.xml. How do I do that?


oh yeah, that is what I meant. This is how I did it.

<string-array name="my_items">
  <item>@string/item1</item>
  <item>@string/item2</item>
  <item>@string/item3</item>
</string-array>

It resolved correctly in Android 1.6


You can't. It might be possible to do the reverse: have @string/item1 in the <string-array>.

0

精彩评论

暂无评论...
验证码 换一张
取 消