Density in AVD manager

hackhack

Active Member
Licensed User
Longtime User
When you make a new virtual device you have to enter a density - how important is that? And how do you figure out what it is?
 

jschuchert

Active Member
Licensed User
Longtime User

Aren't dp and px reversed in the formula?
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
I understand what the quoted part of the document is trying to say and I agree with the greater the density, the more screen pixels per dp, but I think the way it is expressed is confusing:
px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels.

IF px = 1 physical pixel and dp = 1 density independent pixel
Solving the equation algebraically for 240 dpi
px=dp*1.5 (240/160)
therefore
dp = px/1.5
but to satisfy the statement in red
it would have to be dp=px * 1.5
or
more physical pixels per dp.
That's why I thought px and dp should be exchanged in the equation

Is my logic wrong?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
therefore
dp = px/1.5
Correct for a 240dpi scale 1.5 screen!
but to satisfy the statement in red
it would have to be dp=px * 1.5
Wrong I'm afraid. Device independent pixels are meant to display approximately the same physical size on all screens so the higher the dpi of the screen the more physical pixels are needed for each dp.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…