开发者

Dynamically adjust the column and row of a Table Layout based on orientation

开发者 https://www.devze.com 2022-12-22 14:00 出处:网络
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?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消