显示密度和资源使用率(LDPI / MDPI /华电国际/ xhdpi) [英] display density and resources usage (ldpi/mdpi/hdpi/xhdpi)

查看:99
本文介绍了显示密度和资源使用率(LDPI / MDPI /华电国际/ xhdpi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我就HTC智能手机800×480显示屏。我一直以为,这是华电国际的设备。而我用下面的code确保:

So I got HTC smartphone with 800x480 display. I always thought that it is HDPI device. And I was ensured using the following code:

Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getMetrics(displayMetrics);
displayDensity = displayMetrics.densityDpi;

它说我的设备是240dpi。但实验我已经发现Android的威胁,我的设备只能作为MDPI。我敢肯定,这个回合。我测试了相同的另一个为800x480(ZTE)和结果是一样的 - 它显示240 displayDensity但是Android的威胁它作为MDPI设备......但是,为什么会这样呢?在android.devepoler他们说240dpi是华电国际。我完全糊涂了。见鬼,为什么240 threated为MDPI?

it says my device is 240dpi. But experimentally I'd discovered that android threats my device only as MDPI. Im sure bout this. I tested the same with another 800x480 (ZTE) and result was the same - it shows 240 in displayDensity but android threats it as MDPI device... But why is it so? On android.devepoler they said that 240dpi is HDPI. I'm totally confused. Why the heck 240 is threated as MDPI?

我要如何发现Android的对待我的HTC为MDPI设备:
总之我做了什么,以确保 - 我把一个大的图像绘制,华电国际(AOS猜测会使用它)和较小的一个可绘制,MDPI,比跑一个应用程序,看看它会使用。它总是从绘制,MDPI,而不是绘制,华电国际使用的图像。要知道如何像它看起来像我的设备我跑的应用程序previously把图像项目绘制文件夹中。结果
然而,像我上面提到的,我猜是我的800x480 HTC是华电国际由于基于displayDensity但不能在配置code。配置我的设备是Configuration.SCREENLAYOUT_SIZE_NORMAL和好像这就是为什么AOS把我的设备,因为只有MDPI的原因。因此,在240dpi的DisplayDensity(必须是华电国际,而不是MDPI)它真的令人沮丧的结合。所以,现在的问题是,为什么有240dpi配置的显示密度设置设备MDPI类型?请告诉我这是为什么?我的想法是独一无二的检测设备类型的方式是它的显示密度。而且,如果它是240dpi它必须是HDPI设备代替MDPI

How I'd discovered that android treats my HTC as MDPI device: In short what I made to ensure - I put a big image to drawable-hdpi (guessing AOS gonna use it) and smaller one to drawable-mdpi and than ran an app to see which it gonna use. And it always used image from drawable-mdpi instead of drawable-hdpi. To know how which image looks like on my device I ran app previously putting images to drawable folder of project.
However, like I mention above, I was guessing that my 800x480 HTC is HDPI due to code based on displayDensity but not on Configuration. Configuration says my device is Configuration.SCREENLAYOUT_SIZE_NORMAL and seems like thats the reason why AOS treats my device as MDPI only. So in conjunction with DisplayDensity of 240dpi (which must be HDPI instead of MDPI) it really frustrating. So now the question is why with Display density of 240dpi Configuration sets device to MDPI type? Whats the reason of this? I was thinking that the one and only way to detect the device type is its display density. And if it is 240dpi it must be HDPI device instead of MDPI.

推荐答案

您可以尝试阅读此页:的 http://developer.android.com/guide/topics/resources/providing-resources.html ,它将显示屏幕密度和其他人一个完整的解释,当你想整理资源文件夹。

You may try to read this page: http://developer.android.com/guide/topics/resources/providing-resources.html , it shows a complete explanation about screen density and others when you want to organize your resource folder.

关于设备被当做MDPI它可能像Nexus 7,我们确信,这是MDPI,但它使用从华电国际形象,也有一些值从MDPI / sw600dp(的东西,你会找到更好的在这个链接解释上面有),由于其密度,实际上是TVDPI,所以它的华电国际和MDPI之间的中间密度。试着下载一个名为ScreenInfo一个应用程序,在GOOGLEPLAY。它显示了有关设备屏幕上各种信息,并可以帮助你确保你的HTC。

About device being treated like MDPI it may be like Nexus 7, we were sure that it was MDPI, but it was using images from HDPI and also some values from MDPI/sw600dp (things that you will find better explained at that link above there), because its density, actually was TVDPI and so it's a 'middle' density between HDPI and MDPI. Try to download an app called ScreenInfo, on GooglePlay. It shows various informations about device screen, and may help you to make sure about your HTC.

希望它帮助。

这篇关于显示密度和资源使用率(LDPI / MDPI /华电国际/ xhdpi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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