简体   繁体   English

如何在 Spinner 中显示列表项中的特定索引

[英]How to Show Specific index from List item In Spinner

I have this dummy response.我有这个虚拟的反应。 I need to Show Result list in Spinner but with specific index.我需要在 Spinner 中显示结果列表但具有特定索引。 Like I don't want to show all list items in the spinner.就像我不想在微调器中显示所有列表项一样。 I just wanted to show index 4,11,6.我只想显示索引 4、11、6。 How to sorting that.如何排序。

{
"status": "OK",
"message": "Sucess",
"result": [
{
"id": 2,
"name": "DHAKA",
"countryId": "001"
},
{
"id": 4,
"name": "RAJSHAHI",
"countryId": "001"
},
{
"id": 11,
"name": "RANGPUR",
"countryId": "001"
},
{
"id": 6,
"name": "SYLHET",
"countryId": "001"
}
]
}
  • Maybe you should create a new list which only contains the items you want to display.也许您应该创建一个仅包含您要显示的项目的新列表。
  • Create an adapter to display the items in spinner, so that you can handle the case and display items only according to the index that you want.创建一个适配器来显示 spinner 中的项目,以便您可以处理案例并仅根据您想要的索引显示项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM