All the examples I have found assume that Spinner is given an array of
String.
I have a Spinner whose Adapter contains an Object more complex than a
String.
I want the capacity to display some parts of this object.
  a) during drop down
  b) when the item is selected.
Nothing fancy, just some straight text, but I need ot whole object.

I configured the adapter as per every example I have seen:

  MyAdapter adapter = new MyAdapter(this,
android.R.layout.simple_spinner_item, myObjects);
 
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);

I can't find anywhere that describes what is contained in the layouts
android.R.layout.simple_spinner_item and
android.R.layout.simple_spinner_dropdown_item. So I'm not really sure
what is there and is available for use.

If I override Adapter#getView, the View that super#getView returns is
a TextView, so I could set that to be some relevant text value, but it
feels kind of undocumented. I did try inflating a layout containing 2
TextViews and populating them, but UI became a bit screwed up. I'm not
really sure what's ok to change here and what's not.

Likewise, the above presumably applies to the drop down view, but I am
also not sure how to render the selected item.

Anyone have any ideas?

At worst I could strip out an array of String which I could show in
the Spinner but it doesn't feel like the right solution.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to