0
点赞
收藏
分享

微信扫一扫

Android xml文件里读取string array


example:XML file saved at res/values/strings.xml : <? xml version = "1.0" encoding = "utf-8" ?>

<resources> 
<string-array name = "planets_array" >
<item> Mercury </item>
<item> Venus </item>
<item> Earth </item>
<item> Mars </item>
</string-array>
</resources>



This application code retrieves a string array:



Resources res = getResources () ; 
String [] planets = res . getStringArray ( R . array . planets_array );

举报

相关推荐

0 条评论