I struggled with this also and finally wrote a custom view component derived from ViewGroup. I added a setAdapter() method and inside that I go through the adapter contents, just like you would in an AdapterView-derived class. For each data item in the adapter, call getView() from the adapter and do a addViewToLayout() on each text view. During onMeasure() and onLayout(), you have to figure out how to layout the children, so you can figure out the dimensions and when to start a new row, etc. I added some XML attributes, like android:verticalSpacing, android:horizontalSpacing and android:padding and took care to honor padding when laying out the ViewGroup.
On Dec 30, 6:44 am, legerb <drim...@gmail.com> wrote: > I'm struggling with the following: > I have a linear layout with horizontal orientation, which I'm adding > text views dynamically (with WRAP_CONTENT layout params). The problem > is that when reaching the screen border, instead of placing the new > text view on a new line, the new textview is placed in the end with > multiple line breaks. > Here's what it looks like: > > http://lh4.ggpht.com/_HX7nu4IEeEg/SztX7G-EFrI/AAAAAAAAEME/mEk6EcjjGeA... > > I would like the TextView05 to be placed on a new line. Is that > possible? > I don't know ahead how many text views i will have to place, i want > them to be placed one after another, and prefer to keep them in the > same linearlayout. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en