Android Emulator Reports 600x1024 Mdpi As Xlarge?
Solution 1:
This seems to be a bug in the documentation. If we look at the actual code that is used to calculate screen size, we can see that a 600x1024 screen at 160 dpi will indeed be considered as xlarge.
Don't take my word for it. The implementation is in WindowManagerService.computeNewConfigurationLocked() (warning for slow JavaScript). The interesting bits are as follows. The screen size in pixels is scaled based on density:
longSize = (int)(longSize/dm.density);shortSize = (int)(shortSize/dm.density);
For a an mdpi (160 dpi) screen, dm.density will be 1.0. For hdpi (240 dpi) it will be 1.5. In our case we have an mdpi screen. So after this code has run, longSize == 1024
and shortSize == 600
. Shortly after, we reach this code:
// What size is this screen screen?if (longSize >= 800 && shortSize >= 600) {
// SVGA or larger screens at medium density are the point// at which we consider it to be an extra large screen.
mScreenLayout = Configuration.SCREENLAYOUT_SIZE_XLARGE;
} elseif ( // ...
which with our values of longSize
and shortSize
means that mScreenLayout
will be assigned Configuration.SCREENLAYOUT_SIZE_XLARGE
, in other words that the screen will be considered 'xlarge'. It is interesting to note that if the screen was one pixel smaller on the short side, it would only be considered as 'large'.
So, you are reading the documentation correctly, but as far as I can see, the documentation is wrong and your emulator is just fine.
Post a Comment for "Android Emulator Reports 600x1024 Mdpi As Xlarge?"