tags:

views:

342

answers:

2

I'm attempting to create a list view in Android that shows clickable items that wrap horizontally much like the "To" field in the OS X and iPhone's Mail programs. They have a horizontal list of names that wrap vertically and each name is a separate object, the list is not just a single string. My questions are:

  1. Is there a way to do this with a ListView or some other type of AdapterView? Everything I've seen and experimented with is either horizontal scrolling or vertically stacking, but not horizontal wrapping.

  2. Are you aware of an existing app with available source that has a view like this that I could look at as an example? The Google Mail/SMS apps just has a single string in the too field that isn't clickable.

+1  A: 

I think you'll have to create custom view for that. The closes i can think of would be a Gallery and you can look at it's source. In theory all you need a view that extends one of layouts and then you add bunch of child views to it, preferably via adapter. YouView.setAdapter

This session has good example of creating custom view. Not sure where is the source though- should be in aosp if they didn't remove it http://code.google.com/events/io/2009/sessions/SupportingMultipleDevicesBinary.html

Alex Volovoy
Thanks, I was afraid that was probably the right answer. Thanks for pointing me in the right direction with the link!
Marcus
np also in case you've missed it - there is a general guide here http://developer.android.com/guide/topics/ui/custom-components.htmland of course source.android.com
Alex Volovoy
A: 

I found a pretty good answer to this question here:

http://stackoverflow.com/questions/549451/line-breaking-widget-layout-for-android

Marcus