Android advanced ADB Show Layout Bounds

Show layout bounds can be activated by ADB and is a really helpful option especially when it comes to polish UI and check everything is alright.

Layout Bounds

This option can be activated by command line exiting the app, setting the property and starting the app again.

 adb shell am force-stop com.company.appname ; adb shell setprop debug.layout true ; adb shell am start com.company.appname 

 

An even easier way to achieve this is using a Groovy script available here

https://github.com/dhelleberg/android-scripts

Commands are easy and in real-time:

  • devtools.groovy overdraw on/off (it will show/hide overdraw in current UI)
  • devtools.groovy layout on/off (it will show/hide layout bounds)
  • devtools.groovy gfx on/off (it will show/hide gpu rendering)

 

There is also a youtube video with a quick demonstration:

https://www.youtube.com/watch?v=GOJaOsJ0BJs

 

The second file in the project is another Groovy script to help connect your device with adb in Wifi mode.

(Precondition: android device and your Mac/PC must share the same WiFi Network)

These are the commands without using adbwifi.groovy script to achieve the same.

Connect the device via USB and from terminal type

 adb shell ip -f inet addr show wlan0 

Take note of the IP address of the device

 adb tcpip 5555 
 adb connect DEVICEIP:5555 

Disconnect the USB cable, the device should be connected via WiFi

Try to type

 adb devices 

Outcome will be

 List of devices attached
 DEVICEIP:5556 device

Using the script is much easier, simply connect your phone via USB (in best case with WiFi switched on), run adbwifi.groovy and wait until it tells you to disconnect and press enter.

 

Remember to install Groovy if you decide to use the script above.

4 thoughts to “Android advanced ADB Show Layout Bounds”

  1. The effective command is

    adb shell setprop debug.layout true

    Just know you have to restart the app in order to make the change active.

Leave a Reply

Your email address will not be published. Required fields are marked *