1

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.

Marcus
  • 2,021
  • 2
  • 21
  • 20

2 Answers2

3

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
  • 67,778
  • 13
  • 73
  • 54
  • Thanks, I was afraid that was probably the right answer. Thanks for pointing me in the right direction with the link! – Marcus Jan 08 '10 at 22:58
  • np also in case you've missed it - there is a general guide here http://developer.android.com/guide/topics/ui/custom-components.html and of course source.android.com – Alex Volovoy Jan 08 '10 at 23:12
0

Check workspaceview, http://code.google.com/p/andro-views/source/browse/trunk/src/org/jared/commons/ui/WorkspaceView.java?r=2

It may need some customization to get exactly the right UI effect.

skoperst
  • 2,259
  • 1
  • 23
  • 35