views:

209

answers:

1

I have a complex layout file with many TextView's and EditText's placed on the canvas. The layout needs to be a ScrollView in order to properly work for the user. The problem is that 2 fields should really be ListView's with all the formatting that comes with them. Neither of these lists will be more then 10 lines long. I am currently using a TextView by creating a long string from the data and displaying it.

The problem is that I cannot format the text in the TextView like I can within a ListView.

Since I cannot place ListView's within a ScrollView, I need to simulate it by using a TextView . I need to format the data into columns like I would in a ListView, with data wrapping in the second display field, being a different font based on the rows condition.

Is there any way to format the data in a TextView to look like data in a ListView such as below:

21   This is the data for   NA  
     this item.

1/2  This is the data for   Q  
     the second item.

3    This data should be a  NA  
     different font.

Can anyone tell me how to do this?

A: 

Use more than one TextView, probably in a TableLayout inside of a ScrollView.

CommonsWare
It did not work. I already tried using more TextViews within a talelayout (30 of them). I have them set to layout_height="wrap_content", but they are not wrapping. I think it might have something to do with changing the visibility between gone and visible.
miannelle
@miannelle: There is nothing magic about a `ListView` that causes text to wrap. If you cannot do it with `TextViews`, then you cannot do it with a `ListView`. With respect to the `TableLayout`, add `android:shrinkColumns="1"` (assuming column index 1 is the one with the long text in it).
CommonsWare