Hierarchy viewer source code android

Double-click on the view to see an enlarged image of it. Figure 3.

Android Tutorial 2019 - Android View and View Hierarchy Introduction Part-1

Parts of the view node display. To see the view's properties, click the View Properties tab in the left pane, as shown in figure 4. To save a layered screenshot of your layout to an Adobe Photoshop PSD file, click Capture the window layers in the toolbar. Each view is saved as its own layer so you can easily create a new mock by hiding and adjusting each view. Now that you know your way around the tool, you can use it to profile your view hiearchy and interpret the results.

Start Android Device Monitor

Each child view of your selected node gets three dots, which can be green, yellow, or red. The left dot represents the draw process of the rendering pipeline.

The middle dot represents the layout phase. The right dot represents the execute phase.

Programming interface for Android Hierarchy Viewer - Stack Overflow

Figure 6. How the colored dots relate to the rendering pipeline.


  • Android ConstraintLayout—The Guide to ConstraintHelpers.
  • Android Device Monitor.
  • 24 day challenge app for iphone?
  • punch quest app for android.

These dots roughly correspond to the measure, layout, and draw phases of the processing pipeline. The color of the dots indicates the relative performance of this node in respect to all other profiled nodes in the local family. Hierarchy Viewer measures the performance of each node relative to sibling views , so there are always red nodes in a profile—unless all views performed identically—and it doesn't necessarily mean that the red one is performing poorly only that it's the slowest view in the local view group.

Hierarchy Viewer rasterizes your layout to acquire the timing information. Rasterization is the process of taking a high-level primitive, such as a circle or a vector font, and turning it into pixels on the screen.

Your Answer

Typically, rasterization is done by the GPU on your device, but in the case of software rasterization, rendering is done on the CPU with ordinary software. This means that the absolute reported timings are correct relative to each other, but are bloated and vary depending on the overall and changing CPU workload on your device and your development machine. So it does not reflect real-world performance speeds on a device and you should profile multiple times to get a sense for the average measurements. A red node is a potential problem in any situation where your app has unexpectedly slow performance.

In a relative setting, there is always a slowest node; just make sure it is the node you expect. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. Hierarchy Viewer is a library which allows to display views tree of your application in the simple way on your Gooogle Chrome browser.

How to use? If you want to just display your views tree - without your custom values or your custom views - you have to call the start Context static method from HierarchyViewer class , in the onCreate method in your application object as is shown in the code below:. If you create your custom view and you want to display some custom values for your view you have to implement your own model for this view which extends from model correspondent for view.

You created you own MyTextView which contains members superHint as is shown in the code below:.

Hierarchy Viewer

Now you have to add your view model info for confing which is passed as param for Hierarchy Viewer Library as is shown in the code below:. Using When you run your applicaiton you will see notification which will inform you about server ip address. Your computer has to be in the same network as your device. When you will open link in your browser you wil see infromation about your views tree.

Online training

This works only on Google Chrome. Skip to content. Dismiss Join GitHub today GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together. Well, since Hierarchy Viewer is open source, you can poke around at its code and try to work out some sort of quasi-API.

Since your approach will be unsupported, though, it is possible that occasionally you will have to revisit your work and update it to take into account new changes to adb and so forth. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service , privacy policy and cookie policy , and that your continued use of the website is subject to these policies.


  • Profile your layout with Hierarchy Viewer.
  • Get set up!
  • Android Hierarchy Viewer – A Clearer Look at UI.

Wei Yang Wei Yang 3 8 CommonsWare CommonsWare k Do you know where can I find the code of Hierarchy Viewer? I don't see where it is browseable online courtesy of the kernel.

Start Hierarchy Viewer