Francesco Cariaggi Francesco Cariaggi - 1 year ago 109
Android Question

Android "custom" Spinner

What I need to achieve is a

with these properties:

  • The
    allows the user to select from a fixed set of strings. Those strings are localized, so an English user has different choices than a French user.

  • When I try to retrieve the value of the selected item of the
    , I don't want it to return the localized value of that selected item, but rather the "non-localized" one (in my case, the English value of that string).

How could I achieve this kind of thing? Would a custom
suffice? I've been stucking here for a while.

Answer Source

Ok, a custom Adapter was sufficient to do the trick. I've also defined a layout resource (for elements in the spinner) containing two TextViews: one with visibility="Visible" and one with visibility="Gone". The former holds the localized value, while the latter holds the english value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download