简体   繁体   English

如何管理不同分辨率和不同dpi的布局文件夹?

[英]How to manage the layout folders for different resolutions and different dpi?

I have doubt that how we are going to create the different layouts to support all android mobile devices. 我怀疑我们将如何创建不同的布局来支持所有Android移动设备。 As we know that we will be creating different layouts (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi..) in res folder. 我们知道我们将在res文件夹中创建不同的布局(mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi ..) What is my question is eg: I am having two mobiles say moto e(253dpi) and samsung galaxy e7(267dpi) where both are xhpdi. 我的问题是:例如:我有两个手机说moto e(253dpi)和三星galaxy e7(267dpi) ,两者都是xhpdi。 Now I will be creating xhdpi for them. 现在我将为他们创建xhdpi。 But here the two screen resolutions differs (moto e(540x960) and e7(720x1280) respectively). 但这里两个屏幕分辨率不同(分别为moto e(540x960)和e7(720x1280))。

Now if I give some hard coded values in xhpdi xml. 现在,如果我在xhpdi xml中给出一些硬编码值。 Whether my layout remains same for both devices? 两个设备的布局是否相同? Without any alignment issues? 没有任何对齐问题?

Use following folders if you wish to have tablet-specific layouts: 如果您希望具有特定于平板电脑的布局,请使用以下文件夹:

layout-large-mdpi   (1024x600)
layout-large-xhdpi  (1200x1920)
layout-xlarge-mdpi  (1280x800)
layout-xlarge-xhdpi (2560x1600)

For Mobiles: 对于手机:

res/drawable        (default)
res/drawable-ldpi  (240x320)
res/drawable-mdpi  (320x480)
res/drawable-hdpi  (480x800)
res/drawable-xhdpi  (720x1280)
res/drawable-xxhdpi (1080x1920)
res/drawable-xxxhdpi (1440X2560)

Dinems for mobiles: 手机用餐:

res/values/dimens.xml(default)
res/values-ldpi/dimens.xml   (240x320)
res/values-mdpi/dimens.xml   (320x480)
res/values-hdpi/dimens.xml   (480x800)
res/values-xhdpi/dimens.xml  (720x1280)
res/values-xxhdpi/dimens.xml (1080x1920)

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

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