tags:

views:

35

answers:

1

Hi,

Is it possible for my android application to dynamically adjust the no of column and no of row of my TableLayout based on orientation?

For example, when in landscape mode, the TableLayout is 3x2 and when in portrait mode, the TableLayout is 2x3?

Thank you.

+1  A: 

You can use two Folders to hold two different Xml files that will each represent the two TableLayout configurations.

The layout folder will hold the normal portrait set up.

And create a folder called layout-land and put the landscape setup in here.

Then when the device switches to landscape mode your app will switch to the setup in layout-land and vice versa.

Be aware that you will have to save and reload any data you wish to persist

Donal Rafferty