6

I'm trying to handle layout for different screen but I found it hard because emulators always use default layout. I cannot understand why. I create a Nexus 7 emulator and I expected to use layout-sw600dp. The same with Nexus 10 emulator. How came?! Thanks in advance R.

4 Answers4

2

There are 2 versions of the nexus 7 that you can choose from. There's the newer model and the 2012 version. Choose the 2012 version and it should work as expected.

enter image description here

DroidT
  • 3,168
  • 3
  • 31
  • 29
1

Check your layout directories once again, you might have picked wrong type of resource file. Also I'd suggest to use layout-sw600dp for 7inch tablets and layout-sw720dp for larger ones.

Ivan V
  • 3,024
  • 4
  • 26
  • 36
  • Thank's for replying to me Ivan. Resource files has the same name and I already created sw600dp and sw720dp, but both 7" and 10" keep using default layout. This just happens with emulator. It works with real devices. – Ruben Rocco De Luca Aug 14 '15 at 07:01
  • Sounds weird... Are you using standard Android Studio emulator or Genymotion? – Ivan V Aug 14 '15 at 10:12
  • I'm using IntelliJ (it's as the same as Android Studio more or less). I created two emulators (nexus 7 & 10). I use SDK 4.0 (so there's not any compatibility problems with layout-sw600dp and layout-sw720dp folder). – Ruben Rocco De Luca Aug 14 '15 at 14:50
  • 1
    Try to use Genymotion to see if it solves the issue! Also Genymotion is much more realistic than native emulators (lots of useful features) and you will also be able to install Google Play Services and Play Store on it to test apps that are using Maps, pair emulator with Android Wear and more. – Ivan V Aug 15 '15 at 07:29
  • Thank you for your advice, but I prefer to not install no new software. I'll be wating to see if someone else have the same problem. – Ruben Rocco De Luca Aug 17 '15 at 14:38
1

When you create emulator go in Advanced settings and custom skin definition enter "no skin"

emulator skin

Andrea M
  • 11
  • 2
1

There is a bug with Nexus 7 (2013) emulator. It thinks that its resolution is 1280x800, and since it is xhdpi device, final width is 400dp, so it misses sw600dp qualifier. You can track bug here: https://code.google.com/p/android/issues/detail?id=209440

I will update this answer when the bug is closed.

Alexander Mironov
  • 3,095
  • 26
  • 28