Android 布局文件夹:layout、layout-port、layout-land [英] Android layout folders: layout, layout-port, layout-land

查看:91
本文介绍了Android 布局文件夹:layout、layout-port、layout-land的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定是否理解了几个 Android /res/layout 文件夹所扮演的角色.

I'm not sure to have understood well the role played by the several Android /res/layout folders.

layout:一般布局

layout-port:必须更改为纵向的小部件的布局

layout-port: layout for widget that must change for portrait orientation

layout-land:必须为横向而改变的小部件的布局

layout-land: layout for widget that must change for landscape orientation

例如在 Home 示例应用程序中, 下layout-portlayout-land 文件夹只有一个 home.xml 文件.

For example in the Home sample application, under layout-port and layout-land folders there is only one home.xml file.

我理解对了吗?

推荐答案

如果您在横向或纵向模式下,Android 首先在 -port 或 -land 目录中查找布局文件,如果找不到,则回退到默认布局目录.

If you are in landscape or portrait Android looks for the layout file in either the -port or -land directory first, if it's not found then it falls back to the default layout directory.

您可以在此处阅读有关提供替代资源的信息.除了陆地和港口之外,还有更多选择.

You can read about providing alternative resources here. There are many more options than just land and port.

这篇关于Android 布局文件夹:layout、layout-port、layout-land的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆