Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

android studio 3.3.2 device preview not actually changing devices

Hi, I'm using android studio 3.3.2 which is not the same as the interactive story tutorial at all. I'm aware there could be some issues but I wanted to use the latest version. My problem is that the device preview is not accurately representing what my app will look like at all. When I actually run the emulator the app looks fine just like in the tutorial, but when I have the device preview up inside the IDE I get something that looks much different. Is anyone else having the same problem? Also when I try to change devices, if I change from a phone to a tablet it will be different. But if I change from a Nexus 5 to a Pixel 2 nothing changes at all.

Thanks for your help

2 Answers

Hi. the Pixel 2 and the Nexus 5 have the same screen ratio (16:9), so it's normal not to notice any difference between the 2.

Try switching to the Pixel 2XL (which is a taller device, with an 18:9 screen ratio), you should see a difference.

As for the preview not showing the same layout as the emulator, are you using the exact same device in the preview and the emulator?

Hope that helps :)

sort of, that answers the question why it's not changing at least. My device preview actually looks like this: https://ibb.co/v4M3y9b which is nothing like any emulator I've ever seen. I also cannot change the size of the preview at all, and selecting the device in question does nothing. Changing the device will change the dimensions, but there's always that big white gap in the middle, and it's not indicative at all of what the app will actually look like when running on the emulator.

Thanks for your help!

Thank you for the pic. The problem is that by default, the preview in the layout editor no longer shows the status bar, toolbar and bottom navigation bar, meaning that the layout in your preview will match the device height while in the emulator the layout will be "shorter" as space will be taken by the toolbar/navigation bar, explaining the difference (a bigger white gap in the preview).

To enable the toolbar and navigation bar in your layout preview, click on the eye icon (View Options) at the top left corner and check Show Layout Decorations at the bottom of the drop-down list. That should fix it.

Thank you so much!

You're welcome :)