简体   繁体   中英

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. Now I could find 2 480x800 screens one with high density and other with low. 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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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