Android 2.2的 - 屏幕分辨率和尺寸的问题尺寸、屏幕分辨率、问题、Android

2023-09-09 21:01:21 作者:安于天命ゝ

Android版本为2.2。而应用程序将不支持绘制-xhdpi 绘制-XLARGE 文件夹中。然而,我遇到过很多问题,当我从不同移动处理不同的屏幕尺寸。

The android version is 2.2. And the apps will not support drawable-xhdpi with drawable-xlarge folder. However, i have met many issue when I am processing different screen size from different mobile.

第一个问题是,我想知道的是,Android将加载从正确的图像绘制,LDPI,绘制,MDPI,绘制,华电国际文件夹中的情况?有每个文件夹中的一个图像(绘制-LDPI,绘制,MDPI,绘制,华电国际)。

The first problem is that I want to know what is the situation that android will load correct image from drawable-ldpi, drawable-mdpi, drawable-hdpi folder? There are one image in each folder (drawable-ldpi, drawable-mdpi, drawable-hdpi).

(1)240像素点¯x150像素的绘制,LDPI结果(2)320像素点¯x200像素的绘制,于mdpi结果(3)480像素x 300像素的绘制,华电国际

(1) 240px x 150px for drawable-ldpi (2) 320px x 200px for drawable-mdpi (3) 480px x 300px for drawable-hdpi

但是为什么我看不到正确的图像,如果输出设备宽屏幕是480像素?输出装置只示出320像素宽的图像。不是480像素的图像。这个问题似乎是我所缺少的东西?

But why i cannot see correct image if the output device width screen is 480px? The output device only shown 320px width image. Not the 480px image. The issue seems that what the thing i have missing?

然后,我改名绘制的所有文件夹,可绘制小,绘制正常,绘制大型。据工作是绘制大型可显示480像素宽度的图像。这将是很好,如果我做到这一点的方法吗?

Then, i renamed all drawable folder to drawable-small, drawable-normal, drawable-large. It is working that drawable-large can display 480px width image. Will it be good if i do this way?

第二个问题是,一些三星设备都得到了不同的屏幕分辨率,我想知道如何支持这些屏幕分辨率,因为我想打800像素宽屏幕显示800像素宽度的图像,900px宽屏幕显示900px宽的形象?任何方法都可以做不同的屏幕分辨率?很多人说,该文件夹绘制-xhdpi可以解决的问题,图像可以自动缩放。我看不到任何图像可自动缩放。也许我错过了一些步骤。

The second issue is that some samsung device have got different screen resolutions, i would like to know how to support these screen resolution as I want to make 800px width screen displays 800px width image, 900px width screen displays 900px width image? Any method can do different screen resolution? Many people said the folder drawable-xhdpi can solve issue that image can be auto-scaling. I cannot see any image can be auto-scaling. Maybe i have missing some steps.

请告知。

非常感谢。

推荐答案

我会尽量给你更好地了解这一点。

I will try to give you better insight into this.

屏幕可以分成更多或更少的4个不同的类别:

Screens can be divided into more or less 4 different categories:

低密度中密度(基线)高密度超高密度

您还可以得到xxhdpi这些天...

You also get xxhdpi these days...

低密度= LDPI(120DPI)

low-density = ldpi (120dpi)

中密度= MDPI(160dpi)

medium-density = mdpi (160dpi)

高密度=华电国际(240dpi)

high-density = hdpi (240dpi)

超高密度= xhdpi(320dpi)

extra-high-density = xhdpi (320dpi)

http://developer.android.com/images/screens_support/screens- ranges.png

^ h TTP://en.wikipedia.org/wiki/List_of_displays_by_pixel_density

h ttp://en.wikipedia.org/wiki/List_of_displays_by_pixel_density

^ h TTP://checkscreensize.appspot.com/listdevice.jsp

h ttp://checkscreensize.appspot.com/listdevice.jsp

您将始终与设计多种布局/图形内容的应用程序来支持不同的设备。不只是三星的设备,但大部分品牌有不同的像素密度和分辨率不同的设备。

You will always be designing apps with multiple layouts/drawables to support different devices. Not just Samsung devices, but most brands have different devices with different pixel densities and resolutions.

总之,通过提供多种资源,Android将选择正确的一个最适合当前的设备,如果它没有找到一个在一定的布局或绘制文件夹,它只会使用下一个最佳的布局/资源与名称。

In short, by providing multiple resources, android will choose the correct one to best fit the current device and if it does not find one in a certain layout or drawable folder, it will simply use the next best layout/resource with that name.

请注意,这是为了避免拉伸和绘图和布局不正确的缩放。

Note, this is to avoid stretching and incorrect scaling of drawables and layouts.

在您的清单文件。

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />

不同的屏幕大小提供不同的布局或可绘制资源。

pre Android 3.2的/ 13 API,使用布局小/正常/大/ XLARGE。 Android 3.2的/ API 13后,使用布局华电国际,或布局sw600dp等。

下面是您可以使用预选赛的正式表格,通过把它们之间的破折号:

Here is the official table of qualifiers you can use, by placing a dash between them:

http://developer.android.com/guide/practices/screens_support。 HTML#预选赛 http://developer.android.com/guide/practices/screens_support.html#qualifiers 布局LDPI 布局于mdpi 布局华电国际布局xhdpi 布局大布局大土地布局XLARGE 布局XLARGE土地

和您可绘:

绘制-LDPI 绘制-MDPI 绘制,华电国际绘制-xhdpi 三星Galaxy S3(720x1280,xhdpi,普通屏幕大小)三星Galaxy S2(480×800,华电国际,普通屏幕大小)三星Galaxy王牌加(分辨率320x480,MDPI,普通屏幕大小)三星Galaxy迷你(240×320,LDPI,普通屏幕大小)三星Galaxy Tab 10.1(800x1280,MDPI,X大屏幕大小)三星Galaxy Tab 7.0(600x1024,华电国际,大屏幕大小)

设计这些设备可以确保应用程序将在大多数其他设备藏汉工作的伟大。

Designing for these devices ensures that the app will work great on most other devices aswell.

希望这些信息帮助。