Question

I have a 1st Generation Nexus 7 that I am testing with. The app I'm working on only supports portrait. I'm trying to use the h1024dp numeric selector on the drawable directory to use specific images for devices like the Nexus 7. My directory is named:

drawable-h1024dp-hpdi

It is my understanding that any hpdi device that has a height of 1024 or more would use the drawable in the directory above.

I'm using hpdi as the second selector on that directory because my Nexus 7 is pulling its other drawables from the drawable-hdpi directory.

The screen size of my Nexus 7 is 1205 x 800 as detected by this code:

Display display = getActivity().getWindowManager().getDefaultDisplay();
Point screenSize = new Point();
display.getSize(screenSize);
screenHeight = screenSize.y;
screenWidth = screenSize.x;

My app is NOT using the drawables in the drawable-h1024dp-hpdi directory as I expected it would.

What am I missing?

Was it helpful?

Solution

What am I missing?

1024dp would be a height of 1024 density-independent pixels. One density-independent pixel is 1/160th of an inch, so 1024 of them are 6.4 inches. Your Nexus 7 does not have a screen size that is 6.4 inches high -- it is about 5.9 inches. Hence, that resource set does not qualify.

Or, to look at it another way, the screen height is 1280px at ~213 dots per inch (-tvdpi), which works out to around 960dp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top