0

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.

  • 1
    Please post the layout xml file(s). Include also any values (particularly dimensions) that are referenced by the layout. – Ted Hopp Jan 17 '12 at 04:28
  • The xml file is rather large, I have uploaded to google docs: https://docs.google.com/open?id=0BzrCAhSkqDnbNTJmMzNmNGUtYjEwYi00OWU1LTlkYTgtZWQyNTMzMGUzOTA5. My app is created for tablets and have two layouts, depending on the screen resolution. This layout is for the 1024x*** resolutions. The display works for most 1024 tablets, but fails with the original Samsung Tab. As I am a beginner and still learning, please excuse my code if it looks like a very bad way of doing it. Thank you. – Android Beginner Jan 18 '12 at 04:24

2 Answers2

2

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.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
0

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

Jin35
  • 8,602
  • 3
  • 32
  • 52