本文介绍了Android的多个屏幕大小和密度的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的可绘制一个真正的问题,我只是似乎无法弄清楚。

I'm having a real problem with my drawables that I just can't seem to figure out.

问题是这样的:

有尺寸的屏幕分辨率320x480左右,480×800,为480x854

There are screen sizes at approximately 320x480, 480x800, 480x854

然后有最通常密度在1.0(160)和1.5(240)

Then there are most commonly densities at 1.0 (160) and 1.5 (240)

现在,在一个德罗伊德,屏幕尺寸是480×800,密度是使用DisplayMetrics 1.5报告

Now, on a Droid, the screen size is 480x800 and the density is reporting using DisplayMetrics as 1.5

在G1,这是小320x480和报告回1.0的密度

On the G1, it's 320x480 and reporting back at a density of 1.0

但平板电脑的汇报,在480×800与1.0(160)的密度

BUT tablet devices are reporting back at 480x800 with a density of 1.0 (160)

所以,我要疯了,因为我可以把在可绘,MDPI文件夹小320x480的图像和480x800的图像中可绘制 - 华电国际的文件夹,但在平板电脑,不管是什么它没有调整任何东西,以一个完整的画面。

So, I'm going mad because I can put 320x480 images in the drawables-mdpi folder and 480x800 images in the drawables-hdpi folder, but on Tablet computers, no matter what it's not resizing up anything to a full screen.

任何帮助将是很大的AP preciated。我只是希望我的所有小320x480的图像,无论该设备的按比例增加。

Any help would be greatly appreciated. I just want all of my 320x480 images to scale up regardless of the device.

推荐答案

您可能会丢失您的清单等一些标签, anyDensity 支持... 。体面平板电脑仅支持随 XLARGE (姜饼我认为)。

You might be missing some tags in your manifest such as anyDensity and supports.... Decent tablet support only came with xlarge (in Gingerbread I think).

此外,如果你正在绘制自己,你需要调用 setTargetDensity(actualDensity)在你的画布,绘制或位图(不记得其中三个)。

Also if you are drawing yourself, you need to call setTargetDensity(actualDensity) on your canvas, drawable, or bitmap (can't remember which of the three).

这篇关于Android的多个屏幕大小和密度的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:36