简体   繁体   English

Android UI(布局+资源)适用于不同的屏幕尺寸和不同的densties

[英]Android UI (Layouts + Resources) for different screen sizes and different densties

First of all, I have seen all the available answers on SO but could not get exactly what I wanted to ask, therefore I am writing this question here, it might help others too. 首先,我看到的,因此所有可用的答案,但无法得到正是我要问,所以我在这里写了这个问题,它可以帮助别人了。

What I know 我知道的

To support multiple densties we should provide different resources (images) in drawable folders by considering the following, 为了支持多个densties,我们应该考虑以下内容,在drawable文件夹中提供不同的资源(图像),

ldpi    :  0.75x
mdpi    :  1x
hdpi    :  1.5x
xhdpi   :  2x
xxhdpi  :  3x
xxxhdpi :  4x

For example, if we have an image of size 100X100 px in mdpi then, size of icons for other densties will be, 例如,如果我们在mdpi中有一个大小为100X100像素的图像,那么其他代表的图标大小将是,

ldpi    :   75X75 px
mdpi    :   100X100 px
hdpi    :   150X150 px
xhdpi   :   200X200 px
xxhdpi  :   300X300 px
xxxhdpi :   400X400 px

My Questions: 我的问题:

  1. As there can be multiple screen resolutions in one density then while designing the icons for suppose mdpi which resolution should be considered? 由于在一个密度中可以有多个屏幕分辨率,那么在设计图标时,假设mdpi应该考虑哪个分辨率? Suppose the designer is creating the Screen in Photoshop and then will give cut outs of the icons, then which screen resolution from mdpi should be considered? 假设设计师在Photoshop中创建了屏幕然后会给出图标的剪切,那么应该考虑来自mdpi的屏幕分辨率?

  2. Will same image be shown on all the screen resolutions having same density. 将在具有相同密度的所有屏幕分辨率上显示相同的图像。 For example, like we have resolution from 480X600 to 1920X1200 in hdpi, then will same image be shown on these two resolutions? 例如,就像我们在hdpi中有480X600到1920X1200的分辨率一样,那么这两个分辨率会显示相同的图像吗? Will it not look small in 1920X1200 resolution rather than 480X600? 它在1920X1200分辨率而不是480X600下看起来不小吗?

  3. What if we want to design a custom background image that should fit properly to all screen sizes? 如果我们想要设计一个适合所有屏幕尺寸的自定义背景图像,该怎么办? What should be the approach for the same? 对于同样的方法应该是什么? Suppose we want to design a background image for hdpi, then for which resolution should we design it? 假设我们想为hdpi设计一个背景图像,那么我们应该为它设计一个分辨率? (480X600 or 1920X1200). (480X600或1920X1200)。 I think it will not fit properly on all screen sizes. 我认为它不适合所有屏幕尺寸。

  4. What should be a better approach to make the design to be resolution independent? 什么应该是使设计独立于分辨率的更好方法?

  5. What designers here do is, select a resolution, design the whole app screen in that resolution, cut out/slice the psd to get icons. 设计师在这里做的是,选择分辨率,在该分辨率下设计整个应用程序屏幕,剪切/切片psd以获取图标。 But this way the design becomes resolution dependent, it doesn't work good on other screens with other resolutions. 但是这种设计依赖于分辨率,在其他分辨率的其他屏幕上效果不佳。 What should be the best way to achieve screen resolution independent. 什么应该是独立实现屏幕分辨率的最佳方式。

Any body knows good solutions to create resolution independent UI for Android? 任何机构都知道为Android创建独立于分辨率的UI的好解决方案?

Thanks. 谢谢。

As per my experience what I learned is, 根据我的经验,我学到的是,

  1. Phones 手机

     hdpi - 480 x 800 xhdpi - 768 x 1280 xxhdpi - 1080 x 1920 xxxhdpi - 1440 x 2560 

    Tables large-mdpi - 600 x 1024 xlarge-mdpi - 800 x 1280 表大mdpi - 600 x 1024 xlarge-mdpi - 800 x 1280

  2. For tablets design different cutouts. 对于平板电脑设计不同的剪裁。

  3. Get it created for all the resolutions you want to support. 为您想要支持的所有分辨率创建它。
  4. Getting cutouts for most famous resolution for each category. 为每个类别获取最着名分辨率的剪裁。
  5. Get cutouts for one resolution from each category and different cutout images for tablets. 获取每个类别的一个分辨率和平板电脑的不同剪切图像的剪切。

Here I'm giving answer of your first 3 questions. 在这里,我将回答你的前三个问题。 See below: 见下文:

  1. Designing icons for mdpi, you should consider 320x480 mdpi resolution as a base standard. 为mdpi设计图标,您应该考虑320x480 mdpi分辨率作为基本标准。 According to this, you can resize images for different screen resolutions. 根据这个,您可以调整不同屏幕分辨率的图像。

  2. If you consider mdpi as your UI baseline, then you need to resize images as per 0.75x : 1x : 1.5x : 2x : 3x : 4x this scenario/std. 如果您将mdpi视为UI基线,则需要按照0.75x:1x:1.5x:2x:3x:4x调整图像大小,这个场景/标准。

  3. Designing background image, you need 480x800 hdpi image size. 设计背景图像,您需要480x800 hdpi图像大小。 Because most of hdpi devices lie on 480x800 this size. 因为大多数hdpi设备的尺寸为480x800。

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

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