问题描述
我设计一个背景我的应用程序的所有Android设备。我想这将是图像的像素大小?
I am designing a background for my app for all Android devices.I was thinking what would be the size of the image in pixels?
从开发者网站,我发现下面的公式
From the developer site I found the following equation
PX = DP *( DPI / 160)
px = dp * (dpi / 160)
然后,PX取决于两个变量。
Then, px depends on two variables.
首先,DP,我们有
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
二,DPI和我们有
Second, dpi and we have
low-density (ldpi) screens (~120dpi).
medium-density (mdpi) screens (~160dpi).
high-density (hdpi) screens (~240dpi).
extra high-density (xhdpi) screens (~320dpi).
那么,我应该把我的可绘制在屏幕的特点呢?我的意思是我应该用尺寸或密度。如果我使用了大小,DP分类我的图片,什么是DPI这些图片?如果我使用了密度,DPI,什么是DP这些图片我的图片进行分类?
So where should I put my drawables in the Screen characteristic? I mean should I use "size" or "Density". If I classify my images using the "size" "dp", what is the dpi for these images?and if I classify my images using the "density" "dpi", what is the dp for these images?
我很困惑如何最终的大小我的图片。另外,也许你可以有一个大屏幕尺寸中密度屏幕,对吧?
I am confused on how to finally size my images. Also, Maybe you can have a medium density screen with a large screen size, right?
推荐答案
有很多的很多不同的分辨率在那里。例如可能有4分别不同的设备:
There are many many different resolutions out there. For instance there could be 4 different devices which are:
640 PX ×480的 PX
640 px x 480 px
不同的是,其中一些设备是MDPI,有些是华电国际,xhdpi等。这意味着它们可以被描述为大,中等或XLARGE的屏幕类型。
The difference is, some of these devices are mdpi, some are hdpi, xhdpi etc. meaning they could be described as "large", "medium" or "xlarge" screen types.
因此,对于一个MDPI设备是640x480dp背景是640x480px然而,一种设备,它是640x480dp和华电国际将需要一个背景,是960x720px,你会发现它们是相同的尺寸桶,但有不同的密度,因此,不同的分辨率。
So, for an mdpi device which is 640x480dp the background would be 640x480px however, a device which is 640x480dp and hdpi would need a background which is 960x720px, you'll notice they're the same size "bucket" but have different densities and therefore different resolutions.
所以,如果你只是想你的背景,以适应以及可以预见的,你需要:
So, if you just want your background to fit as well as can be expected you'll need:
- 大xhdpi
- 大tvdpi
- 大华电国际
- 大MDPI
- 大LDPI
(当时同为正常)
- 在正常xhdpi
- 在正常tvdpi
等等等等。
您是不过最好的办法是使用的可拉伸,形状,瓷砖或可转换为一个9修补程序,因为它会在臀部,使每一个背景可为各种设备痛苦的图像。如果你打算这样做,我会找一个资源descrivbing市场上的每一个屏幕尺寸目前并通过编程方法设置它。
You're best bet however is to use an image which can stretch, a shape, tile or can be converted to a 9-patch because it would be a pain in the rump to make every background available for every device. If you were going to do it I would look up a resource descrivbing every screen dimension on the market currently and setting it via programmatic methods.
这篇关于对应用程序的背景,不同的Android设备尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!