-1

I have seen other questions addressing this but the answer never seemed to fit my issue so I thought I'd ask if myself.

I have developed a small Android app and originally tested it against a Galaxy Nexus emulator. I then tested it on a Galaxy S4. Eventually I wanted to make it available on a broader number of devices and began implementing some of the support libraries.

When I went to test this I began using a Nexus S 2.3 emulator image, and I realized my layout was exceeding the screen. Looking at the screen sizes of the two "devices", that made sense. So I would create a different layout (or possibly a different strings.xml with shorter label names, but for now we'll just focus on layouts) which would be used by the Nexus S.

Unfortunately, I can't find a folder name that causes the Nexus S to pick it up while the Galaxy Nexus does not.

What's more, I'm not even sure this is considered good design. I think I may have read that, in general, phones (vs tablets, etc) ought to use the same layout (though honestly that sends wrong to me).

Can someone explain the behavior I'm seeing and tell me how I'd set this up so I have a different layout for the two devices (or why that's a bad idea)?

Maybe the combination of these two will help. It's possible the issue is that I was trying to create a layout for smaller devices to target the Nexus S when, in fact, it is considered "normal" and I should have been trying to create a layout to target the "larger" Galaxy Nexus...

Galaxy Nexus
Nexus S

I'll also be looking at this

SOLVED Just to close this out, the above was exactly what it took. Rather than thinking of the Galaxy Nexus as "normal" and the Nexus S as the exception, it turns out that, from Android's perspective, the Nexus S is more "normal" and the Galaxy Nexus will pull from an "sw360dp" (layout-sw360dp, values-sw360dp) profile if it's available. So, creating a styles.xml with my regular font-sizes in values-sw360dp and then changing the default styles.xml's fonts to a smaller values did the trick.

Community
  • 1
  • 1
Michael
  • 4,010
  • 4
  • 28
  • 49
  • http://developer.android.com/guide/practices/screens_support.html. check this will help – Raghunandan Aug 17 '13 at 06:48
  • I appreciate this, but it doesn't really help me with the practical side of implementing this for the two devices as I've described. See my other comments. – Michael Aug 17 '13 at 19:49

2 Answers2

0

You have to make different layout in res folder to ensure layout fits in every device, Just copy and paste your xml which is creating a problem in different layout i.e

layout-large , layout-small etc, And after that do make it fixed so that your xml fits in device,

FYI: ldpi handsets will fetch your layout xml from your layout-small , so u Dont have to worry about rest of your devices. Here is link that help you

hemantsb
  • 2,049
  • 2
  • 20
  • 29
  • I understand the concept. The problem is putting it into practice and doing so with the practical example I've given - the Nexus S vs the Galaxy Nexus. – Michael Aug 17 '13 at 12:00
0

res/layout/my_layout.xml // layout for normal screen size ("default")

res/layout-small/my_layout.xml // layout for small screen size

res/layout-large/my_layout.xml // layout for large screen size

res/layout-xlarge/my_layout.xml // layout for extra large screen size

res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png // bitmap for medium density

res/drawable-hdpi/my_icon.png // bitmap for high density

res/drawable-xhdpi/my_icon.png // bitmap for extra high density

This is the best approach as per design guidelines set for Android UI best practices.

LokiDroid
  • 972
  • 10
  • 22
  • I understand that. My problem is that I can't find a layout folder naming convention which will be picked up by one of these two very different devices, but not the other. – Michael Aug 17 '13 at 10:01