5

Sometimes I'm editing the layout resource for a list item or similar small UI component. This is nice, but the available screen resolutions in the layout editor in Android Studio are all way too big to get a reasonable sense of how the list item or whatever will look. Even when using the smallest resolution available (2.7" QVGQ) there's always a ton of unused space:

enter image description here

If I try to have elements match_parent or match_constraint then they blow up to take up the entire space of the editor:

enter image description here

How can I use custom screen resolutions in Android Studio's layout editor? It would let me get a better idea of how these smaller UI component layouts will actually look. My Google searches have all been futile. Within Android Studio I was able to add a new device definition with a very small resolution, but it doesn't show up in the list of available resolutions in the layout editor. Help!

UPDATE:

I checked in the "Generic Phones and Tablets" menu as per Chisko's suggestion below, but my virtual device wasn't there.

enter image description here

enter image description here

BUT after restarting Android studio, it appeared:

enter image description here

So Chisko is right, but there also appears to be a bug in Android Studio where the creation of a virtual device isn't reflected in the "Generic Phones and Tablets" menu until a restart has occurred.

Josh Hansen
  • 1,408
  • 2
  • 17
  • 20

2 Answers2

4

If you added a custom device try looking on Generic Phones and Tablets option. Refer to screenshot:

custom devices

Chisko
  • 3,092
  • 6
  • 27
  • 45
  • No such luck. I see my device in the AVD manager (called "Menu Item Ish" with a 50x200 resolution) but it doesn't appear in the "Generic Phones and Tablets" menu. – Josh Hansen Mar 12 '18 at 21:56
  • @JoshHansen Creating an AVD and a custom device is not the same thing. Try clicking on Add device definition. You can customize more than just the resolution. Once added, you will see it there. Try it. – Chisko Mar 12 '18 at 22:00
  • When I click "Add Device Defintion..." in the layout editor menu, it brings up the AVD Manager itself, so in my version of Android Studio (3.0.1) they appear to be exactly the same thing. Nonetheless, your suggestion is ultimately correct, but it required restarting Android Studio for it to work. See my update to the main question above. – Josh Hansen Mar 12 '18 at 22:02
4

Follow these steps:

1) Click on "Add Device Definition..."

2) Make your specific device in opened window

3) restart Android Studio

4) you can find Your New device in the list. (above of "Generate Phones and Tablets" in AVD Devices part)

Milad Yarmohammadi
  • 1,253
  • 2
  • 22
  • 37
mhKarami
  • 844
  • 11
  • 16