Thanks for the info. As result of another discussion I already had a
look at the DisplayMetrics class. They clearly state there, that I
can't rely on dip because it's just based on the default density
(160dpi, 240dpi, 320dpi, etc.) which is nearest to the device's real
density. So this (official) docu is simply wrong:
http://developer.android.com/guide/practices/screens_support.html

So at least theory allows correct scaling, if I don't use XML (which
from my point of view is a design error). But in practice HTC
Sensation unluckily returns crap when trying to read ot X and Y DPI.
Both values are around 160 whereas they should be something around
256.

Regards,
Niels

On Oct 6, 4:54 pm, Studio LFP <[email protected]> wrote:
> I don't think you will be able to do this with a XML layout. You probably
> want to take a look at this
>
> http://developer.android.com/reference/android/util/DisplayMetrics.ht...
>
> There is both xdpi and ydpi. That should be checked to get the actual dpi in
> both directions and then a view created with those calculations should get
> you where you want to go.
>
> Here is what I get on a few of my devices in portrait mode:
>
> // --- Sample Code Start ---
> DisplayMetrics metrics = new DisplayMetrics();
> Display display = getWindowManager().getDefaultDisplay();
> display.getMetrics( metrics );
>
> Log.i( "TestProject", "X DPI: " + metrics.xdpi );
> Log.i( "TestProject", "Y DPI: " + metrics.ydpi );
> // --- Sample Code End ---
>
> *Samsung Galaxy Tab (7 inch):*
> X DPI: 168.89351
> Y DPI: 169.33333
>
> *Motorola Droid Bionic:*
> X DPI: 258.79245
> Y DPI: 256.67368
>
> *Sony Xperia Play:*
> X DPI: 239.05882
> Y DPI: 243.72585
>
> Steven
> Studio LFPhttp://www.studio-lfp.com

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

Reply via email to