How to create a wrapping horizontal list [duplicate]

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.

Asked by: Marcus899 | Posted: 20-01-2022

Answer 1

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

Answered by: Maria178 | Posted: 21-02-2022

Answer 2

Check workspaceview,

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

Answered by: Kristian258 | Posted: 21-02-2022

Similar questions

Android trouble with layout horizontal wrapping

I am having trouble getting content to fill width with the following layout. When i add stuff to contentPane it always acts as wrap_content regardless of what the child itself has specified. I have tried changing gravity to fill and the result is the same. What am i missing? <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+bottom_button_panel/root" android:layout_width="...

java - Android: Crash on rotation, horizontal to vertical

I'm playing around with android, and I'm creating a simple twitter app to test what I've learned so far. But I've run into a problem that I don't understand. I created a thread to fetch the tweets, no problems there, but then added a ProgressDialog to show when that thread was running. Doing so caused a very unusual behavior. If the user rotates from Vertical orientation, to horizontal orientation, program behaves as e...

android - Horizontal scroll problem

I am relatively new to Android. I am working on an application wherein i want to display digital signals. But the problem is once I occupy the available screen width how to i add a scrolling feature to continue viewing the signal. Also i am drawing the signal using using drawLine(), so what co-ordinates should i set for drawing the lines when scrolling is enabled? Can somebody please give a simple example where a line exte...

How to add a Horizontal BarGraph in Android platform?

Any one please help me to build a horizontal bar graph in my android platform

android - Horizontal "tab"ish scroll between views

I'm interested in creating a horizontal scroll view that "snaps" to the viewed item, so only one item is ever shown at a time. The user can touch-drag left/right and will see previous/next views, switching to it if there's enough velocity. This interaction is exactly like what the new weather/news widget that comes with the Nexus One does for navigating between its "tabs". Are there any existing view widgets that d...

image - Android horizontal scrollview behave like iPhone (paging)

I have a LinearLayout inside a HorizontalScrollView. The content is just a image. While scrolling, I need to achieve the same behavior you get when setting the paging option on a the iPhone equivalent of the HSW (scrolling the list should stop at every page on the list, not continue moving). How is this done in Android? Should I implement this features by myself or there is a particular property to set or a subclas...

alignment - android: how to align image in the horizontal center of an imageview?

I've tried all scaletypes, but all of them result in the image to be at the left corner of the imageview. <ImageView android:id="@+id/image" android:scaleType="centerInside" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="6dip" android:background="#0000" android:src="@drawable/icon1" />

scroll - Android horizontal scrolling showing Cursor data

I have some text data in database which I have retrieved in a Cursor, and I am displaying it in a ListView. What I want to do now is that when you select click a particular row in the list its text content should be displayed in full screen and the user should be able to scroll horizontally (like scrolling between iPhone home screens) to view the contents of the Cursor.

java - Camera Preview View, Horizontal when should be Vertical Worked fine on HTC Tattoo, broke on Nexus

I'm using a Nexus One and the Camera displays horizontal when it should be vertical and vice versa. I've no idea what's wrong. The code works fine on a HTC tattoo. Anyone have any idea what's wrong? class Preview extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder mHolder; Camera mCamera; Preview(Context context) { super(context); // Install a SurfaceHolder.Callback so we get no...

android - How do you put two Views in a horizontal Layout so that one is aligned to the left and the other one - to the right?

Let's say you want to have a TextView and a Button in a Layout with horizontal orientation. Can you have the TextView aligned to the left and the Button - to the right? --------------------- TextView Button ---------------------

Horizontal ListView in Android?

Is it possible to make the ListView horizontally? I have done this using a gallery view, but the selected item comes to the center of the screen automatically. I don't want the selected item at the same spot I clicked. How can I rectify this problem? My idea was to set the ListView with a horizontal scroll. Share your idea?

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android