7

What is the folder for resources and layout that the Samsung Galaxy Nexus searches for resources? I thought it's layout-large, but it isn't. It doesn't find the main layout (on setContentView), and crashes.

Then I try layout-xlarge, again the same problem. I have nothing in 'layout' folder and drawable folders are drawable and drawable-hdpi (only these two).

Galaxy Nexus is 720 x 1280 pixels, 4.65 inches (316 ppi pixel density).

Thanks.

2 Answers2

14

The Galaxy Nexus is an xhdpi device, with a sw360dp size screen (roughly a "normal" size screen in the old style identifiers). So layouts will be found in /layout-sw360dp/ and drawables in /drawable-xhdpi/.

Alex Curran
  • 8,818
  • 6
  • 49
  • 55
  • 1
    Also bear in mind, you should really have a back-up layout in `/layout/` unless you are only trying to target specific devices, because your app will just crash if it is a different size screen. – Alex Curran Feb 09 '12 at 14:42
  • do you know of any issue of setting the width of Android ICS (4.x) Dialog's width? I try to put an ImageView and other views inside the Dialog's Layout (content view), but the dialog width is fixed always, does not stretch to the size of the image view and staff.. This only happens on 4.x Android ... I thought this might be a bug. –  Feb 09 '12 at 15:15
  • Just one question please: how did you know that Galaxy Nexus is sw360dp ? Is there a calculation to make ? – androniennn Dec 01 '12 at 15:52
  • 3
    The screen dimensions are 1280x720 pixels. As it is XHDPI, the scale factor of pixels to dips is 2.0, so the screen is 640x360 dips, and 360dip is the smaller of those numbers. – Alex Curran Dec 04 '12 at 16:16
  • And for HDPI, MDPI, LDPI what's the scale factor of pixels to dips? Thank you very very much for your response. – androniennn Dec 04 '12 at 17:27
  • 1
    hdpi = 1.5, mdpi = 1.0, ldpi = 0.75. I believe xxhdpi is 3.0 – Alex Curran Dec 08 '12 at 21:17
  • As @Espiandev says and you can check in this [Android cheatsheet for graphic designers](http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/#screen-densities-and-icon-dimensions), **xxhdpi scaling factor is 3.0** – Francisco Alvarado Aug 19 '13 at 20:51
1

My phone is htc one x,and with the same pixels and density with the Samsung Galaxy Nexus,but when i create a folder layout-sw360dp for the phone,and when i run the app in the phone,i found that the folder is not used any more.Thanks!