Ahmad Baracat
Ahmad Baracat

Reputation: 480

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

Upvotes: 0

Views: 211

Answers (1)

FoamyGuy
FoamyGuy

Reputation: 46856

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.

Upvotes: 2

Related Questions