gpt4 book ai didi

java - 我想显示字符串数组的特定部分而不是其他部分。字符串数组用于国家/地区、国家/地区代码和每个国家/地区的 ISO

转载 作者:行者123 更新时间:2023-12-02 00:09:02 25 4
gpt4 key购买 nike

好的,下面是我的 xml 代码 fragment :

<string-array name="country_data">
<item>
<font color="#7c7b7b">
<country>Afghanistan</country>
<countryCode>93</countryCode>
<iso2>AF</iso2>
<iso3>AFG</iso3>
</font>
</item>

我想在微调器对象中仅显示国家/地区。我可以显示所有数据,并且如果项目中只有国家/地区,则可以执行此操作,但我希望其余数据也可以在需要时在其他地方引用。

我的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

关于java - 我想显示字符串数组的特定部分而不是其他部分。字符串数组用于国家/地区、国家/地区代码和每个国家/地区的 ISO,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58135594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com