layout not scaling in hdpi devices

1k views Asked by At

I have created a tablet specific app that looks good in the mdpi devices. However, when the app is displayed in hdpi devices, the layouts and images look too big.

Here is the first screenshot that looks good in a 7" tablet with 170 dpi. https://docs.google.com/open?id=0BzrCAhSkqDnbNWJhMjhmMjgtM2U2Yi00NTEwLWE0ODItZGJiOTBkYzM0MWY2

Here is the second screenshot that is taken from the emulator with 240 dpi set. I thought it is an issue with the emulator, but the same thing happens with the original Samsung Tab which reports itself as a hdpi device. https://docs.google.com/open?id=0BzrCAhSkqDnbY2NmOTFkZGQtNDEyNC00MDJmLTljOTQtOTYzNGIxNmJiNDEz

All my images are under the folder drawable-mdpi. My layout is a combination of background images and imageviews and uses several RelativeLayouts and FrameLayouts. Creating corresponding images under drawable-hdpi is not possible given the number of images and size. My android:minSdkVersion is 9.

I search all over the Internet and cannot seem to find an answer for this. I don't think ScaleType would work as a lot of my images are based on background.

Also, when I tried this on a hdpi phone (Samsung Nexus), the same thing happens - the layout and images are too big to fit onto the display - that is why I suspect it is due to hdpi devices.

Thank you.

2

There are 2 answers

0
Ted Hopp On

This is not an image scaling problem. It shows all the symptoms of the layout using incorrect size specifications. The lessons on Designing for Multiple Screens are required reading for avoiding these kinds of problems.

0
Jin35 On

All my images are under the folder drawable-mdpi

Here is you problem. You have to provide pictures for hdpi, ldpi, xhdpi for good appearance on any device. Look here for more info