问题
This code:
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
is reporting landscape xdpi = 195.38461 on the new Nexus 7. My tape measure says the screen is 1/16" shy of 6" wide, and at 1280 pixels, that works out to 215.57894.
And yes, our Android.xml says:
<uses-sdk android:minSdkVersion="16"/>
Is this just a bug, or are we doing something wrong?
回答1:
From this response from Dianne Hackborn:
Sorry you just can't use them. Nothing in the platform makes use of them. They need to be set by the manufacturer (there is no way for the platform to know what they are), and as of today they are just not consistently set correctly across devices, and because nothing in the platform relies on them it is easy for devices to have them set incorrectly.
Basically, you can't rely on what that returns, at all.
来源:https://stackoverflow.com/questions/12115860/wrong-dpi-value-for-nexus-7-bug-in-the-platform-or-are-we-doing-something-wro