Android Studio:多种布局,特别是横向平板电脑
我正在 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
单击创建其他...从可用限定符框中选择方向。单击>>按钮。在屏幕方向中选择横向。在目录名称中粘贴以下内容: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.
对于平板电脑,您可以使用资源目录
large
、xlarge
和large-land
、xlarge-land
。For a tablet you might use resource directory
large
,xlarge
andlarge-land
,xlarge-land
.