简体   繁体   English

Android屏幕分辨率

[英]Android screen resolutions

I am following this tutorial link 我正在关注本教程链接

There three types of screens 有三种类型的屏幕

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

But there are three folders 但是有三个文件夹

drawabale-hdpi
drawabale-mdpi
drawabale-ldpi

I placed images of xlarge in hdpi that of large in mdpi and that of normal in ldpi but where to place the images of small screens? 我把xlarge的图像放在hdpi中,mdpi中的大图像和ldpi中的正常图像,但是放置小屏幕图像的位置? Sorry for bad english 抱歉英文不好

For example, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens. 例如,以下是应用程序中的资源目录列表,该列表为不同的屏幕尺寸提供不同的布局设计,为小,中,高和超高密度屏幕提供不同的位图可绘制。

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

and Screen Sizes . 屏幕尺寸

I hope this help. 我希望这有帮助。

hdpi , mdpi and ldpi refer to the screen density in dots-per-inch. hdpimdpildpi指的是每英寸点数的屏幕密度。 This is completely separate from the screen size (small, large, etc). 这与屏幕尺寸完全分开(小,大等)。

You can have large screen with low density, or a small screen with high density, etc. 您可以拥有低密度的大屏幕,或高密度的小屏幕等。

You can cater for different screen sizes by putting different layout resources in res/layout-small , res/layout-large , etc. 您可以通过在res/layout-smallres/layout-large等中放置不同的布局资源来满足不同的屏幕尺寸。

These are two different things - hdpi/mdpi/ldpi are screen densities (ie, how many pixels per square centimeter) while xlarge/large/normal/small are screen sizes (the physical dimensions of the screen). 这是两个不同的东西 - hdpi / mdpi / ldpi是屏幕密度 (即每平方厘米多少像素),而xlarge /大/正常/小是屏幕尺寸 (屏幕的物理尺寸)。 So the small screen images would go in drawable-small, normal in drawable-normal, etc. 所以小屏幕图像会进入可绘制的小图像,正常的可绘制正常图像等。

There's a lot more info about this stuff on the Android developer website . Android开发者网站上有关于这些内容的更多信息。

Screen size has no relation with density. 屏幕尺寸与密度无关。 xlarge screen does not mean it has hdpi density. xlarge屏幕并不意味着它具有hdpi密度。 For example tab like galaxy 10.1 pr motorola xoom has xlarge screen but mdpi density so for them you make a separate folder drawable-xlarge. 例如像galaxy 10.1 pr motorola xoom这样的标签有xlarge屏幕,但mdpi密度,所以对于它们你做一个单独的文件夹drawable-xlarge。 and for this you have to add android:xlargeScreens="true" in manifest. 为此你必须在清单中添加android:xlargeScreens="true"

And devices like galaxy s2 or htc desire has hdpi density. 像galaxy s2或htc欲望的设备有hdpi密度。 Devices with small screens like galaxy pop are mostly have ldpi density, normal screens like galaxy ace are mostly mdpi devices and devices with large screens like galaxy s2 are mostly hdpi devices, and some devices like tab P1000 have large screens but mdpi density and for them you have to make folder drawable-large-mdpi. 像galaxy pop这样小屏幕的设备大多数都有ldpi密度,像galaxy ace这样的普通屏幕大多是mdpi设备,而像galaxy s2这样的大屏幕设备大多是hdpi设备,而像P1000这样的设备有大屏幕,但mdpi密度适合他们你必须制作文件夹drawable-large-mdpi。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM