Why use Hierarchyviewer
Unreasonable layouts can slow down the performance of our application UI, and Hierarchyviewer can intuitively get information about the UI layout design structure and various properties visually, helping us optimize the layout design. Hierarchyviewer is one of the tools of our optimizer, which is a very useful tool for Android, which helps us to better view and design the user interface (UI) and is definitely a tool for UI inspection.
How to use Hierarchyviewer
Hierarchy Viewer is a tool released with the Android SDK, located on Android Sdk/tools/hierarchyviewer.bat (the Windows operating system, shown on Mac as Hierarchyviewer), It's also super easy to use, and this tool gives you a detailed understanding of the control layout of the current interface and the properties of a control (name, ID, height, and so on).
1) Connect the device real machine or simulator (the real machine may not be able to connect, I use 2.3, connected, did not read the content);
2) Start the app you want to watch.
3) Open Hierarchyviewer, click the Hierarchyviewer file. After the connection, for example, this figure is obtained in the official document.
4) Double-click on the top, such as the <focused Window>, this is the current window, after loading will show the current interface hierarchy.
5) Look at the hierarchy chart, this diagram is a bit large and can be dragged. The View Hierarchy window shows all the view objects of the activity, and a view can be selected to see the details of the view, preferably the show Extras option in the tool.
6) observe a single view and select a single view to appear as shown in the graphic. Here you will see the time-consuming measure, Layout, draw.
The View Hierarcy can also help you identify low-performance portions of rendering. A red or yellow dot in the view node represents a slower view object. As you step through the application, you can determine whether a view is slow or slow in a particular environment.
Note that low performance does not necessarily indicate a problem, especially as a ViewGroup object, the more child nodes of view, the more complex the structure, the worse the performance.
The View Hierarchy window can also help you find performance issues. Just look at the performance metrics (color dots) of each view node, and you can see which of the slowest view objects are measured (layout or drawing), so you can quickly determine which problem to prioritize.
"Reprint: http://xyzlmn.blog.51cto.com/2532390/1344871"
Robotium--Androidui optimization tool Hierarchyviewer