Spinner - different text of an element in a popup list / list

I have a spinner in my Android app that allows users to select countries. The counter displays the ISO2 code of the selected country for complexity. Here is an example:

Capture 1

As soon as the user opens a pop-up selection list, I want to display more verbose text for each item. Therefore, instead of displaying only β€œAT”, the element should read β€œAT - Austria”, as shown in the following screenshot.

Capture 2

Any ideas how I could achieve this?

+4
source share
1 answer

The SpinnerAdapter has a getDropDownView method that can return another view for an extended state.

+1
source

Source: https://habr.com/ru/post/1337672/


All Articles