Dynamically adjust the column and row of a Table Layout based on orientation
Is it possible for my android application to dynamically adjust the no of column and no of row of my TableL开发者_如何学运维ayout based on orientation?
For example, when in landscape mode, the TableLayout is 3x2 and when in portrait mode, the TableLayout is 2x3?
Thank you.
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
精彩评论