On Wed, Feb 2, 2011 at 6:58 PM, Indicator Veritatis <mej1...@yahoo.com>wrote:

> By "The density and densityDpi is an abstract density bucket the
> device
> manufacturer has decided makes sense for their UI to run in", do you
> mean that the two of them together, 'density' and 'densityDpi' are
> part of one bucket?
>

density and densityDpi are actually different representations of the same
thing.  That is, the density bucket of the device, with:

density = DENSITY_MEDIUM / densityDpi

That is, "densityDpi" is the density bucket, and "density" is the scaling
factory from the original device density.


> Besides: if you answer this unequivocally and clearly, you will
> greatly enhance the quality of this thread, which covers some very
> important topics people have been really confused about since Android
> Day One.
>

Yeah I have struggled for two years to explain this stuff. :)  It really
isn't very complicated, just (a) forget about the idea of trying to do a
true "density-independent UI" from the real display DPI, and (b) likewise
don't worry about the exact screen dimensions.

So instead of trying to exactly scale a UI to the exact display DPI, we just
define some specific scaling factors to reduce all of the possible screen
DPIs into some consistent buckets.  Those are ldpi, mdpi, hdpi, and (more
recently) xhdpi.

This greatly simplifies life for the platform and app developers, while
giving you all of the support you really want to adjust for the screens on
these devices.

Actually, this probably gives you more of what you want than exact density
scaling. :)

For example: the Xoom tablet is an mdpi xlarge screen.  If a company makes a
different tablet with a screen that has the same resolution but is 10"
diagonal instead of 10.5" (or whatever the Xoom is), nothing changes for
apps or the platform -- just for the user the UI is slightly smaller.  But
hey the manufacturer is making a device that is slightly smaller so this is
as much a feature as anything else, just if you go buy a 18" monitor instead
of a 17" monitor of the same resolution, it is natural that the larger
monitor gives you a slightly larger UI.

On the other hand, if someone makes a 10.5" tablet with a 1080p display,
this is a significant different and moves you up into another density bucket
-- that screen falls naturally into a hdpi density xlarge size.  With
Android's density support, all of the UI scales to adjust for that density
without being stupid, exactly as it does when going from an HVGA to WVGA
phone screen (mdpi to hdpi).

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to