如何知道哪些手机支持哪种布局(华电国际,MDPI和xhpi)? [英] how to know which phone support which layout(hdpi , mdpi and xhpi)?

查看:175
本文介绍了如何知道哪些手机支持哪种布局(华电国际,MDPI和xhpi)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何确定哪些手机支持什么类型的布局有点困惑。我做了一些研究,但还没有找到一个满意的答案。

例如,我发现下面的指南:

  XLARGE屏幕至少960dp x 720dp
大屏幕至少640dp x 480dp
正常屏幕至少470dp x 320dp
小屏幕至少426dp x 320dp
 

不过,我还是有一些顾虑:

  1. 三星盛大(480 * 800) HTC野火S(320 * 480)都支持MDPI。这些画面有非常不同的分辨率,但具有相同的布局类型?

  2. GALAXY NOTE 2(1280 * 720),支持华电国际。如果HD(720p)的只有华电国际,在什么设备/解决方案支持XHDPI?

  3. 我已经问了一个相关的问题在这里:的如何在7英寸设置布局;两种不同的平板电脑?

  4. 我的最重要的问题,然而,就是这样:如何知道哪些设备或屏幕分辨率支持每个布局类型

解决方案

机器人对待MDPI(160像素/英寸)为基料的密度。因此,对于 MDPI设备 1 DP = 1像素。在更高的密度,有每英寸更多的像素(240 HDPI,320为xhdpi)。

自动缩放搭载Android本身:

机器人尝试使图形图像在屏幕上占据了相同的物理尺寸而不管所述装置的像素密度。的因此,如果所有它发现是一个MDPI资源,并且该装置是HDPI,它将缩放图形由一百六十分之二百四= 150%,它会加倍图形的大小为xhdpi

使用的显卡不同的版本:

如果你不希望这个自动缩放(它可以使图形看起来差),你可以简单地提供自己版本的图形资源的使用,在更高的密度。这些图形应该是机器人将缩放MDPI资源的大小相同。

注意:像素/英寸的已存储在图像文件中没有任何与此有关。这一切都基于你把图形文件中的资源目录为您的项目。 放在RES /绘制任何图形被认为是适当的大小为MDPI显示,因为是图形放在RES /绘制-MDPI。中发现的清晰度图片的文件/绘制,华电国际被认为是适当的大小为华电国际显示器,等等。当你的程序特定的设备上运行,Android将首先寻找的图形是该设备的显示密度相匹配。如果它没有找到一个,而是发现一个用于一个不同的密度,将使用和基于上述规则自动缩放图像。

由于LDPI,MDPI和华电国际指为屏幕像素密度,其中的意味着多少像素可以放入一个单一英寸

比它们之间的像素是:

  LDPI = 1:0.75
MDPI = 1:1
华电国际= 1:1.5
xhdpi = 1:2
xxhdpi = 1:3
 

所以我们来了图片约100X100大小

 为MDPI应该是100X100
对于LDPI它应该是75X75
对于HDPI应该150X150
对于xhdpi应该200X200
对于xxhdpi应该300X300
 

这种方式,对于具有相同的大小,但不同的DPI屏幕,所有的图像似乎是同样大小的屏幕上。

I'm a little confused about how to determine which phones support what layout types. I've done some research but haven't found a satisfying answer.

For example, I've found the below guide:

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp

However, I still have some concerns:

  1. Samsung grand (480*800) and HTC wild fire S (320*480) both support MDPI. These screens have very different resolutions, yet have the same layout type?

  2. Galaxy note 2 (1280*720) support HDPI. If HD (720p) is only HDPI, when what device/resolution supports XHDPI?

  3. I've already asked a related question here: How to set layout on 7" two different tablet?.

  4. My most important question, however, is this: How do I know which devices or screen resolutions support each layout type?

解决方案

Android treats mdpi (160 pixels/inch) as the base density. So for mdpi devices, 1 dp = 1 pixel. At higher densities, there are more pixels per inch (240 for hdpi, 320 for xhdpi).

AutoMatic Scaling by Android itself:

Android attempts to make graphic images occupy the same physical dimensions on the screen regardless of the device pixel density. So if all it finds is an mdpi resource, and the device is hdpi, it will scale the graphic by 240/160 = 150%, and it will double the size of the graphic for xhdpi.

Using different versions of graphics :

If you don't want this automatic scaling (which can make graphics look poor), you can simply supply your own version of graphic resources for use at higher densities. These graphics should be of the same size that Android would scale an mdpi resource.

Note : the pixels/inch that was stored in the image file has nothing to do with this. It's all based on where you put the graphics files in the resources directory for your project. Any graphics placed in res/drawable are assumed to be properly sized for mdpi displays, as are graphics placed in res/drawable-mdpi. Image files that it finds in res/drawable-hdpi are assumed to be properly sized for hdpi displays, etc. When your program runs on a particular device, Android will first look for a graphic that matches the display density of that device. If it does not find one but instead finds one for a different density, it will use that and automatically scale the image based on the above rules.

As the ldpi, mdpi and hdpi refer to screen density, which means how much pixels can fit into a single inch.

the ratio in pixels between them is:

ldpi = 1:0.75
mdpi = 1:1
hdpi = 1:1.5
xhdpi = 1:2
xxhdpi = 1:3

so lets take an image with about the size of 100X100:

for mdpi it should be 100X100
for ldpi it should be 75X75
for hdpi it should be 150X150
for xhdpi it should be 200X200
for xxhdpi it should be 300X300

this way, for screens with the same size but different DPI, all the images seem the same size on screen.

这篇关于如何知道哪些手机支持哪种布局(华电国际,MDPI和xhpi)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆