且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的:如何在strings.xml中的字符串数组得到项目的属性

更新时间:2021-12-29 06:09:34

据我所知,你是不是能够得到属性的资源字符串数组值。

AFAIK, you are not able to get attribute values for the resources string array.

我看到它的方式是,你可以有如下选择

The way I see it is that you can have the following options


  1. 与您的数据创建一个XML文件作为谢里夫提及。
    例如,

  1. Create an xml file with you data as sherif mentioned. Eg,

<movies>
   <item binder="1" page="1">Star Wars Episode 1: The Phantom Menace</item>
   <item binder="1" page="1">Star Wars Episode 2: Attack of the Clones</item>
   <item binder="1" page="1">Star Wars Episode 3: Revenge of the Sith</item>
   <item binder="1" page="1">Star Wars Episode 4: A New Hope</item>
   <item binder="1" page="2">Star Wars Episode 5: The Empire Strikes Back</item>
</movies>

您可以使用任何F中的avaliable解析器如DOM,SAX解析这个并创建你选择的ArrayList或对象。

You could use any f the avaliable parsers like DOM,SAX to parse this and create an arraylist or object of your choice.

创建JSON数据,而不是XML和使用GSON解析到一个可用的对象。

Create json data instead of xml and use GSON to parse to to a usable object.