![](/img/trans.png)
[英]setListAdapter doesn't display my String-array in the ListActivity
[英]I want to display a certain part of my String-array and not other parts. The string array is for countries, the country codes and the iso for each
好的,下面是我的 xml 代码片段:
<string-array name="country_data">
<item>
<font color="#7c7b7b">
<country>Afghanistan</country>
<countryCode>93</countryCode>
<iso2>AF</iso2>
<iso3>AFG</iso3>
</font>
</item>
我想在微调器 object 中只显示国家。 我可以显示所有数据,如果我在项目中只有 Country,但我希望那里的数据的 rest 也可以在需要时在其他地方引用,我可以显示所有数据。
我的android Java代码如下:
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.country_data, android.R.layout.simple_spinner_item);
country_data 是字符串数组的名称。 我应该更改/添加什么以仅显示阿富汗而不是阿富汗 93 AF AFG
我认为您需要建模/创建 xml 字段的映射
你可以试试这个文档https://developer.android.com/training/basics/network-ops/xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.