kfealz wrote:
> Hey, how can I get an image and text side by side in a spinner?  I'm
> getting the text from an ArrayAdapter, no idea how to put text next to
> it though.

Check out the "list adapter for complex dynamic layouts" thread on 
android-developers:

http://groups.google.com/group/android-developers/browse_thread/thread/355d3cdfa1c787b8

In his case, he wanted 1-3 TextViews per list item, but the same pattern 
holds in your case: subclass ArrayAdapter and implement getView() to 
return what you want. You can either create the per-item View directly 
in Java, or create a layout just for the Spinner entries and use 
ViewInflate to create an instance of that View as needed.

The last couple of messages in that thread cover a performance 
optimization -- re-populating an existing one of your custom Views 
rather than inflating a brand new one.

In your case, your custom View would probably be a horizontal 
LinearLayout with an ImageView and TextView, to get the image and text 
side-by-side.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
The Busy Coder's Guide to Android Development -- coming in June 2008!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to