Android Studio Can't Zoom in/out in Layout Editor
Asked Answered
S

8

12

It used to work from time to time, but now the ability to zoom in/out on the layout design page is completely gone for me. The layout view always stays at 10% zoomed in and doesn't change no matter what I do. Oddly, the preview tab with exactly the same content zooms just fine.

This problem happens across all my projects and layout files, I tried restarting both the app and my computer numerous times, changing the theme from Dracula to IntelliJ and then back, and of course, tried the "invalidate cache and restart" option, but none of them worked. Am I doing something wrong?

I'm using Android Studio 3.2.1 Build #AI-181.5540.7.32.5056338, built on October 8, 2018

Just for reference, here's a screenshot of the design editor page, which stays like that all the time.

XML Editor Design Tab Screenshot

Scent answered 18/12, 2018 at 2:55 Comment(6)
Iff the layout is a ConstraintLayout, CMD(Ctrl) + Mouse Wheel can zoom in/out. This works sometimes.Oedipus
I should mention that I did try that, and it doesn't work. Used to work a while back though.Scent
I am using the same build, but it is working for me. try zooming using the buttons in action bar next to warning icons.Math
@KaranMer I tried that before but it didn't work.Scent
try closing your project and instead of open re import it from new import project and select your project again.Math
Problem solved, I changed the device for preview. Thanks anyways.Scent
A
17

It happens from time to time in Android Studio 3. This are steps to try to resolve this issue:

  • invalidate cache and restart studio;
  • choose different emulator from drop-down menu;
  • refresh layout by clicking on eye icon at the top of layout designer view.
Andersen answered 18/12, 2018 at 6:39 Comment(2)
By choosing different emulator, I think you mean to choose a different device for preview. I tried that and it worked, thanks! So far I have tried all the different devices, all of them worked except for Pixel 2 XL, weird.Scent
@jackz314 that's a bug in Android Studio 3. Not sure how it connected to Pixel 2 XL (actually not only to that, but to some emulators configurations ether) but everything is needed to fix it - choose different emulator layoutAndersen
C
14

The best fix that worked for me was to minimize all the tools on the bottom, i.e Run, Logcat, TODO, Terminal, Build and more ... Then the zoom buttons start working. Even you open the tools back again, the zoom will keep working.

My complete answer is here:

Croatia answered 28/2, 2019 at 13:17 Comment(2)
can confirm this issue exists and fix works for android studio version 3.3.2Nitrogen
I can confirm this issue still exists and the fix works for android studio 3.4. My suspicion is that it, as well as the other ones that involve rearranging or floating windows work because they force a resize. No idea why switching emulators appears to work.Piccard
O
5

I am having the same problem on Androd Studio 3.3.1. The solution is a bit silly. Every time the zoom stops working I drag the bottom area (where you have the logcat/build/run) all the way to the top, so it hides your xml. Then drag it back down.

The zoom will start working again.

Oma answered 24/2, 2019 at 22:20 Comment(0)
C
1

Try changing the device from pixel 2 to something else! Changing the device worked for me. Try clicking on the zoom (+) button after changing the device!

Christianize answered 8/2, 2019 at 6:2 Comment(0)
D
0

Sometimes zooming is freezed when logcat is displayed, so turning logcat on/off often unfreezes zooming.

Digestion answered 8/2, 2019 at 12:14 Comment(0)
T
0

I changed the theme from IntelliJ to Darcula and it worked for me. For some people it has worked the other way round.

Tramway answered 14/2, 2019 at 6:21 Comment(0)
O
0

click on logcat and then again minimize it then the zoom will start working again!!

Oxycephaly answered 18/3, 2019 at 17:52 Comment(0)
V
0
  • Click on the Design Surface button (or press B inside a xml design editor)
  • Select some different design or Force Refresh Layout (or press R).

Demo

Vorlage answered 22/9, 2019 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.