Android Studio:多种布局,特别是横向平板电脑

发布于 2025-01-11 17:41:59 字数 389 浏览 6 评论 0原文

我正在 Android Studio 中为学校项目创建一个应用程序。我需要使应用程序在手机和平​​板电脑上以横向和纵向模式运行。我通过打开“设计视图”并从“预览方向”部分选择“创建 XXXX 变体”,为我的主页创建了 3 种不同的布局。所以现在我有一个适用于纵向手机、横向手机和平板电脑的变体,但我仍然需要一个用于横向平板电脑的版本。我注意到有一个“创建其他变体”,但我不太确定如何将其设置为横向平板电脑。任何建议都值得赞赏

作为参考,这是我的布局文件夹的不同变体的样子。

输入图片此处描述

I am creating an application for a school project within Android Studio. I am required to make the application run on both phones and tablets in both landscape and portrait modes. I have created 3 different layouts for my homepage by opening the Design View and selecting Create XXXX Variation from the Orientation For Preview Section. So now I have a variation for portrait phone, landscape phone, and tablet but I still need one for landscape tablet. I noticed there is a Create Other Variation but I am not exactly sure how I would go about setting that to landscape tablet. Any advice is appreciated

For reference, here is what my layout folder looks like with my different variations.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁吢 2025-01-18 17:41:59

单击创建其他...从可用限定符框中选择方向。单击>>按钮。在屏幕方向中选择横向。在目录名称中粘贴以下内容:layout-sw600dp-land

将在横向模式下的 sw600dp(平板电脑 7 英寸大小)中创建一个同名的新文件夹,其中包含 Activity_main.xml。根据您的要求进行配置。

Click Create Other.. Select Orientation from Available Qualifiers box. Click >> button. In Screen Orientation select Landscape. In directory name paste this : layout-sw600dp-land

A new folder will be created with the same name having activity_main.xml in sw600dp(tablet 7" size) in landscape mode. Configure as per your requirement.

酒解孤独 2025-01-18 17:41:59

对于平板电脑,您可以使用资源目录 largexlargelarge-landxlarge-land

For a tablet you might use resource directory large, xlarge and large-land, xlarge-land.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文