如何创建多个屏幕尺寸? [关闭]

问题描述 投票:0回答:1

我尝试了很多次但没有成功。任何人都可以告诉我一步一步的xml帮助,如何在Android中使用多个屏幕大小?提前致谢。

android android-layout
1个回答
1
投票

请遵循以下步骤:以第一个尺寸创建布局后(假设您的代码如下):

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingBottom="@dimen/activity_vertical_margin"
   android:paddingLeft="@dimen/activity_horizontal_margin"
   android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   tools:context=".MainActivity">

</RelativeLayout>

当您移动光标并单击<RelativeLayout标记时,在行的开头会出现一个提示:enter image description here

单击提示时,它可以帮助您使用当前布局在其他配置中创建布局:enter image description here

现在,您可以使用Size项(不重命名):enter image description here

在新窗口中,您可以选择新的尺寸,然后按OK按钮:enter image description here

现在看目录。您的布局嵌套在包含不同大小的布局的文件夹中。您可以根据需要更改新布局。 enter image description here

请注意,如果要使用相同的活动,则必须在其他配置中使用相同的命名。

© www.soinside.com 2019 - 2024. All rights reserved.