Android spinner在字符串数组的弹出窗口中显示不同的项

Android spinner在字符串数组的弹出窗口中显示不同的项,android,arraylist,spinner,android-spinner,Android,Arraylist,Spinner,Android Spinner,我的微调器允许用户选择国家/地区。我希望所选项目具有 只有第一张图片中显示的国家代码,当用户选择下拉菜单时,弹出窗口将显示更多信息,如图2所示 这就是我迄今为止所尝试的 Spinner spinner = findViewById(R.id.spinnerCountries); ArrayAdapter<String> dataAdapterCountry = new ArrayAdapter<> ( this, R.layout.spinner3_l

我的微调器允许用户选择国家/地区。我希望所选项目具有 只有第一张图片中显示的国家代码,当用户选择下拉菜单时,弹出窗口将显示更多信息,如图2所示

这就是我迄今为止所尝试的

Spinner spinner = findViewById(R.id.spinnerCountries);
        ArrayAdapter<String> dataAdapterCountry = new ArrayAdapter<> ( this, R.layout.spinner3_list, CountryData.countryAreaCodes);
        dataAdapterCountry.setDropDownViewResource ( R.layout.spinner3_dropdown_items );
        spinner.setAdapter(dataAdapterCountry);

我读过,但一直没有完全理解,因为我使用数组。我也不想使用图书馆

是否要在微调器中隐藏图像?你能分享你正在使用的spinner物品的布局吗?@hamzaabas不太可能。我希望下拉式弹出列表中包含的数据比所选项目多您希望列表始终显示项目吗?为什么不使用一个列表呢?微调器有两种模式android:spinnerMode=“dialog”应该执行您在图2中试图显示的操作。
class CountryData {
    public static final String[] countryAreaCodes = {"+960","+223"..."};
    public static final String[] countryNamesFull = {"Maldives +254","Mali +223"...};
   }