开发者

Android: Making landscape view without layout-land?

I just want to group 4 buttons like this...

Portrait mode:

[1][2]
[3][4]

Landscape mode:

[1][2][3][4]

I dont want to hardcopy my Portrait mode xml-File and put it into the "layout-land" folder for this minor difference. Then, I have to modify two file when implementing new stuff.

Isnt that achievable开发者_JAVA百科 through wraping it up intelligently in some LinearLayouts? Something like this? ({} represent LinearLayouts)

{{[1][2]}{[3][4]}}


Isnt that achievable through wraping it up intelligently in some LinearLayouts?

Not automatically. You would still need to dynamically change the outer LinearLayout between vertical and horizontal orientation. You can perhaps do that in your onConfigurationChanged() method.

Another option would be to have layouts in res/layout and res/layout-land, but use the <include> directive, so your buttons are defined once but are imported into their proper spots.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜