Android:横向模式的备用布局 xml [英] Android: alternate layout xml for landscape mode
问题描述
我怎样才能有一种横向布局和一种纵向布局?当用户将手机侧向旋转时,我想假设额外的宽度并节省垂直空间.
How can I have one layout for landscape and one for portrait? I want to assume extra width and conserve vertical space when the user rotates the phone over sideways.
推荐答案
默认情况下,/res/layout
中的布局同时应用于纵向和横向.
By default, the layouts in /res/layout
are applied to both portrait and landscape.
如果你有例如
/res/layout/main.xml
您可以添加一个新文件夹/res/layout-land
,将main.xml
复制到其中并进行所需的调整.
you can add a new folder /res/layout-land
, copy main.xml
into it and make the needed adjustments.
另见http://www.androidpeople.com/android-portrait-amp-landscape-不同的布局和http://www.devx.com/wireless/Article/40792/1954 了解更多选项.
See also http://www.androidpeople.com/android-portrait-amp-landscape-differeent-layouts and http://www.devx.com/wireless/Article/40792/1954 for some more options.
这篇关于Android:横向模式的备用布局 xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!