本文介绍了安卓:如何支持使用不同的XML文件多屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个应用程序,要在多个屏幕上运行它在寻找完全相同。所以我想最糟糕的(根据我的)和最好的方式(按开发商)来创建XML文件的三个单独的文件夹,支持大,中,小屏幕。
我的文件夹名称是布局(据开发商这是默认的,将中等尺寸屏幕WQVGA 400工作),布局大(WVGA800)和布局小(QVGA)。
但是,但是如果我改变一个文件夹布局的东西(它同名的是所有三个文件夹)(默认的),这个变化也适用于大型和中等,但并不适用于小的。不管我在布局大文件夹的XML文件,我改变,这并不适用于大屏幕显示器,但对于小屏幕的布局小作品的变化。所以我想,我怎样才能单独配置单独的大屏幕xml和中等屏幕XML,他们都不会互相影响。

I am building a app, want to run it on multiple screens exactly same in looking. So i tried the worst(according to me) and best way (according to developers) to create three separate folder of xml file to support large, medium and small screen. My folders name are layout(according to developers it is default and will work for medium size screen WQVGA 400), layout-large(WVGA800) and layout-small(QVGA).But however if i change something in a file(which is in all three folders by same name) in layout folder(default one) that change is applying to both large and medium but not applying to small. No matter what i am changing in layout large folder's xml file that doesn't apply to large screen display but changes of layout-small works for small screen. So i want that how can i configure large screen xml separately and medium screen xml separately that they both doesn't affect each other.

推荐答案

根据这个项目,最简单的方法是创造内的每个屏幕尺寸一个人styles.xml'文件夹值:

Depending the project, the easiest way is creating one 'styles.xml' file for each screen size inside values folders:

values  //default
values-small
values-large
varlues-xlarge

然后你只需要管理与风格(改变长度,边距,信尺寸等)4个不同的文件。
如果需要,您还可以添加其他配置@Herry说(大,土地,..)。

Then you only need to manage 4 different files with the styles (changing length, margins, letter sizes, etc).You can also add the other configurations @Herry said (large, land,..) if needed.

这篇关于安卓:如何支持使用不同的XML文件多屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 16:32