In Android Device Monitor there is a tool to dump the view hierarchy for UI automator.
I want to debug the UI for a landscape tablet app, but the screenshot is captured in portrait mode, how can I change this to landscape. The "Screen Capture" option in Android Device Monitor does take a screenshot in landscape mode.
Android Device Monitor: 24.4.1
Device: HTC Nexus 9 running Android 6.0
I also have encountered the problem: the screenshot of a device in landscape orientation is displayed vertical in the View Hierarchy window. It's important, that control boundaries are highlighted correctly as if the screenshot has horizontal orientation, but since the image is not rotated accordingly, the highlighting is inconsistent with the image. The only workaround I have found is to rotate the image manually.
DDMS stores view hierarchy dump in a temporary folder. In my case it is located in the following Windows path: C:\Documents and Settings\User\Local Settings\Temp\uiautomatorviewer_[number]
. You may see the full path in a floating tooltip appearing when you hover your mouse on the .uix
file tab.
After you noted the path, close the .uix
tab for a moment.
The folder on the path contains the .uix
file itself and an image (.png
). The quick fix is to rotate the image by an applicable program. I did it in Windows with standard tools:
Now open the .uix
file anew in the IDE. It will most likely ask you to Specify screenshot - press this button and choose the modified .png
file. Voila.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With