简体   繁体   English

在android上缩放图像

[英]Scaling images on android

I read that when scaling do not use real pixels. 我读到缩放时不使用真实像素。 Is the only reason for this that the images will look blurry? 唯一的原因是图像看起来模糊吗? If yes, so why the screens are categorized for Android into density categories. 如果是,那么为什么屏幕被分类为Android的密度类别。 Now I could find 2 480x800 screens one with high density and other with low. 现在我可以找到2个480x800的屏幕,一个是高密度的,另一个是低的。 So When I supply 2 different images One will have for example 34x34 and the otehr 45x45 BUT Shouldnt both have the same texture or this would make the layout different Since I will be using Pixels to calculate distance and positions? 因此,当我提供2个不同的图像时,一个将具有例如34x34和otehr 45x45但不应该具有相同的纹理或这将使布局不同因为我将使用像素来计算距离和位置?

Regards, Baracat 此致,巴拉卡特

Since I will be using Pixels to calculate distance and positions? 既然我将使用像素来计算距离和位置?

Thats what the dip measurement is for. 这就是倾角测量的目的。 It stands for density independent pixels. 它代表密度无关的像素。 When you supply it with a dip value for size or margins or something it will take that value and calculate how many literal pixels it is going to use for that space depending on which specific screen you are being displayed on. 当您为它提供尺寸或边距的倾角值时,它将获取该值并计算它将用于该空间的文字像素数,具体取决于您正在显示的特定屏幕。

Edit: this page will tell you everything you'll need to know. 编辑:此页面将告诉您需要了解的所有信息。

http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/practices/screens_support.html

it looks like somewhere along the way they changed from using 'dip' to just 'dp' sorry if i've added confusion by using the incorrect acronym, although both still work in code. 它看起来像是他们从使用'dip'变为'dp'的方式。如果我通过使用不正确的首字母缩略词添加了混淆,尽管两者仍然在代码中工作。

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

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