tags:

views:

145

answers:

1

I am having a hard time understanding how to change the width of columns when creating a table view.

I know you can set the width in pixels of a column but that is not what I want to do.

Say, for instance, I have 2 columns and want each column to take up half the screen. How do I do this without explicitly setting the pixels, so that my code can work on multiple screen sizes?

A: 

With a TableLayout? You can't do that easily. The closest you can get is to use android:stretchColumns="*" on your TableLayout element. That should allocate any extra whitespace evenly between the two columns.

CommonsWare
Maybe I'm not using the right terminology. I'm creating a table, is there a way for a specific set of coloumns to make them span the entire screen evenly?
Jeremy
No, there is not -- sorry.
CommonsWare
you would have to do that with a horizontal linear layout for each row with the layout_weight controlling the width. However that does not play nicely once the content varies..
Manfred Moser