简体   繁体   English

如何创建支持不同屏幕尺寸的子文件夹?

[英]How to create subfolder with supporting different screen sizes?

First of all I know how to create subfolder when I have only one Layout. 首先,我知道如何在只有一个Layout时创建子文件夹。 That is not the issue. 这不是问题。 The issue is that I cannot create subfolders under 问题是我无法在以下位置创建子文件夹
layout-sw320dp layout-sw480dp layout-sw600dp layout-sw720dp 布局-sw320dp布局-sw480dp布局-sw600dp布局-sw720dp

Because the layout file names are same in these folders it gives duplicate resource names. 由于这些文件夹中的布局文件名相同,因此它提供了重复的资源名称。 I want to create subfolder in these so How can I do it? 我想在这些中创建子文件夹,那我该怎么做呢?

NOTE: Some "Smart" people things this is a typical subfolder question but it is not. 注意:一些“智能”人物这是一个典型的子文件夹问题,但事实并非如此。 So dont mark this question as duplicate question. 所以不要将这个问题标记为重复的问题。

在此输入图像描述

Why did you create sub-folder in layout? 为什么要在布局中创建子文件夹?

simply create folder according to screen size and place layout which vary according to screen size say,a layout name activity_main.xml 只需根据屏幕大小创建文件夹,并根据屏幕大小放置布局,例如,布局名称activity_main.xml

place it in 把它放进去

-layout:activity_main.xml -layout-sw320pd:activity_main.xml ... .... .. so on -layout:activity_main.xml -layout-sw320pd:activity_main.xml ...... ....等等

If it say duplicate resource ignore that warning because Android itself supporting switching of layouts. 如果显示重复资源,请忽略该警告,因为Android本身支持布局切换。

答案是,在完成子类别的设置后,您实际上可以执行layout-sw320dp,layout-sw480dp等。此问题不是重复的,而且是唯一的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM