如何设置方向在两个不同的模式,有两种布局?有两种、布局、如何设置、方向

2023-09-06 07:22:42 作者:我很fai。

我的布局,被称为的main.xml 和我的设置方向为纵向我的的Andr​​oidManifest.xml 。我设计了这个布局蜂窝太大,并放置在布局XLARGE-MDPI 文件夹,但我想用的main.xml 布局XLARGE-MDPI 仅在横向方向。

I have layout that is called Main.XML and I set the orientation to portrait in my AndroidManifest.xml. I designed this layout for Honeycomb too and placed it in the layout-xlarge-mdpi folder, but I want to use the Main.XML in layout-xlarge-mdpi only in landscape orientation.

现在,怎样才能做到这一点?

Now, how can do this?

感谢

推荐答案

您可以将您的的main.xml 布局XLARGE陆,那么它将只在横向 请参阅支持多画面(使用配置预选赛)

You can place your main.xml in layout-xlarge-land, then it will be used only in landscape orientation Refer Supporting Multiple Screens (Using configuration qualifiers)

Android支持多种配置   预选赛,使您能够控制   系统如何选择你的   基于此替代资源   当前设备的特性   屏幕。一个配置预选赛是   字符串,可以附加到一个   在你的Andr​​oid资源目录   项目和指定   配置的量,资源   内部设计。

Android supports several configuration qualifiers that allow you to control how the system selects your alternative resources based on the characteristics of the current device screen. A configuration qualifier is a string that you can append to a resource directory in your Android project and specifies the configuration for which the resources inside are designed.

编辑: 如果你提供了一个的main.xml 布局文件夹和另一个的main.xml 布局XLARGE陆,然后

If you provide an main.xml in layout folder and another main.xml in layout-xlarge-land, then

超大横向这将采取 main.xml中的布局XLARGE陆

其他,那就是在横向或纵向这将采取 main.xml中的布局

请参照提供了替代资源了解更多详细信息

Refer Providing Alternative Resources for more details