简体   繁体   English

Android设计的屏幕尺寸以像素为单位?

[英]Screen sizes of android design in pixels?

As I found in android documentation site, the there are 4 general sizes for android devices screens. 正如我在android文档站点中发现的,android设备屏幕有4常规尺寸。 but I found the measurements unit in dp . 但是我在dp找到了测量单位。 like this : 像这样 :

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

How to do that on photoshop, how to get the sizes in pixels ? 如何在Photoshop上做到这一点,如何获得像素大小? Do I need to have 4 design ldpi , mdpi , hdpi and xhdpi ? 我需要4个设计ldpimdpihdpixhdpi吗? do I need to have 16 versions of the design. 我需要设计的16个版本。 ?

yes you have 4 designs like : 是的,您有4种设计,例如:

xhdpi = 100% image
hdpi = 75% image of xhdpi image
mdpi = 50% image of xhdpi image
ldpi = 50% image of hdpi image

ie : 即:

if you have 96 x 96 image in xhdpi then, you need to put 如果您在xhdpi中有96 x 96的图像,则需要

72 x 72 in hdpi folder - ( 75 % of xhdpi )
48 x 48 in mdpi folder - ( 50 % of xhdpi )
36 x 36 in ldpi folder - ( 50 % of hdpi )

How to do that in Photoshop ? 如何在Photoshop中做到这一点?

Just create a high res version of your image with width and height as multiple of 16 只需创建图像的高分辨率版本即可, 宽度和高度为16的倍数

Then use my Photoshop Output Android Assets script to generate 然后使用我的Photoshop Output Android Assets脚本生成

  • down-scaled version of images 缩小版本的图像
  • AND " drawable-XXXX " folders for them 和他们的“ drawable-XXXX ”文件夹

Why 16 pixels? 为什么是16像素? For good down-scaling results: 为了获得良好的按比例缩小结果:

ldpi   mdpi   tvdpi     hdpi    xhdpi   xxhdpi  xxxhdpi
0,75   1      1,33      1,5     2       3       4
3      4      5,32      6       8       12      16

Check my SO answer here for more information: What is the best way to create drawables for different dpi 在此处查看我的SO答案以获取更多信息: 为不同dpi创建可绘制对象的最佳方法是什么?

With my app I chose one screen size for it Hdpi And only used one image android:background="@drawable/imagename" 使用我的应用程序,我为其选择了一种屏幕尺寸Hdpi,并且仅使用了一张图像android:background =“ @ drawable / imagename”

If you want one for all sizes make one image Resize it for each one Then edit the XML file so that it can be used by the activity 如果要为所有尺寸制作一个图像,请为每个图像调整大小,然后编辑XML文件,以便活动可以使用它。

See there are may ways, If your background has repeating patterns you can use nine png,you ll get a lot on the internet for the same. 看到有可能的方法,如果您的背景有重复的图案,您可以使用九个png,您将在互联网上获得很多相同的效果。 But if there is no repeating pattern u hve to make 4 images 但是,如果没有重复图案,则必须制作4张图像

to do you need to target screen fist for example you target xhdpi then its 960px*720 pixel with density per inch as 320px 为此,您需要将屏幕拳头作为目标,例如,您将xhdpi定位为960px * 720像素,每英寸的密度为320px

now in photoshop make your all designs with considering max length as 960px and max width as 720px keep density as 320. Now to scale change the density of images as 240 for hdpi 160 for mdpi and 120 now your images will increase in size now scale them as mentioned by ajay in above answer 现在在photoshop中进行所有设计时都考虑最大长度为960px,最大宽度为720px,保持密度为320。现在要缩放,将图像的密度更改为240(对于hdpi为160,对于mdpi为120)现在您的图像将增大尺寸,然后对其进行缩放正如上面回答中的阿杰所说

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

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