What is Hierarchyviewer
The Hierarchy Viewer is a tool released with ANDROIDSDK, located under the Tools folder, named Hierarchyviewer.bat. It's a very useful and easy-to-use tool for Android, which helps us to better view and design the user interface (UI), which is definitely a great tool for UI viewing, and details how to use the hierarchy Viewer in the Android Studio development environment.
How to use HierarchyViewer1 in the Android Studio development environment. Launch the simulator and run your app through the simulator
※hierarchyviewer is unable to connect to the real machine for debugging
The layout file is as follows:
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:id= "@+id/activity_main"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:paddingbottom= "@dimen/activity_vertical_margin"Android:paddingleft= "@dimen/activity_horizontal_margin"Android:paddingright= "@dimen/activity_horizontal_margin"Android:paddingtop= "@dimen/activity_vertical_margin"android:orientation= "vertical"Tools:context= "Com.why.project.confirmcanceldialogdemo.MainActivity"> <ButtonAndroid:id= "@+id/btn_confirm"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "OK dialog box"/> <ButtonAndroid:id= "@+id/btn_confirmcancel"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "OK Cancel dialog box"/> <ButtonAndroid:id= "@+id/btn_confirmcancelbetween"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "OK to cancel Save dialog box"/> <ButtonAndroid:id= "@+id/btn_notitle"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "dialog box without caption"/> <ButtonAndroid:id= "@+id/btn_message"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "dialog box with a lot of content"/> <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Confirmcanceldialog" /></LinearLayout>
2. Open Android Device Monitor
The app runs first and then uses Android Device Monitor.
Click the menu Tools>Android>Android Device Monitor , such as:
3. Enter the Android Device monitor interface to open the Hierarchyviewer
4. Load the node of the current activity, select the analysis
Appendix 1 Saving a tree view as an image Appendix 2 shows the performance metrics (color dots) for each view node and the time-consuming time-consuming of measure, Layout, Draw, select a view, and then click the Swatch icon
Resources:
Use of hierarchyviewer under Android Studio
Using the hierarchy Viewer under Android Studio
How to open Hierarchyviewer in Androidstudio
Use of hierarchyviewer under Android Studio