Android View Hierarchy Analysis: DecorView@a7c23c5 [PortraitADActivity]
This document presents the view hierarchy of 'DecorView@a7c23c5 [PortraitADActivity]' in an Android application. Each view is listed with its type, coordinates, and ID.
View Hierarchy:
android.widget.LinearLayout {260001e V. 0, 0-720, 1280}
android.view.ViewStub {7f6a4e1 G..... ..... 0,0-0,0 #10201b3 android id/action mode_ bar_ stub}
android.widget.FrameLayout {6213c59 V. 0, 0-720, 1280 #1020002 android: id/ content}
android.widget.LinearLayout {44b28a0 W....... ....... 0, 0-720, 1280}
android.widget.FrameLayout {1146f206 G.E...... ......I. 0.0-0. 0}
android.view.View{f9710c7 V.ED..... ..... I
android.widget.FrameLayout {8098da3 V ........ 0, 0-720, 1280}
com.qq.e.conm.plugin.fs.d$b {20c28d2 V. E.
com.qq.e.comum.plugin.fs.h.a{7e875d V.I 0, 0-720, 1280}
com.qq.e.d1.1.k. e. c{cda6d34 V...... .... , 0-720, 1280
com.qq.e.comm.plugin.dl.C$b {3777807 V...... ....... 0, 0-720, 1280}
com.qq.e.comm.plugin.J.h. e{6f7f1c3 V. ED......... 0, 0-720, 1280}
android.widget.ImageView{81d60ff G.E........I.0, 0-720, 1280}
com.qq.e.d1.1.k. e. c{c4a2ecc V. ED..... ....... 0, 680-720, 1280}
com.qq.e.d1.1.k.e. c{5516bb8 V.E.
com.qq.e.d1.1.k.e. c{b710e1b V.E. 0, 0-720, 1280}
com.qq.e.dl.1.k. e. c {388002a 40, 26-680, 114}
com.qq.e.dl. 1.m. a. c{3a04515 G. ED. 0, 14-60, 74}
com.qq.e.dl.1.k. f.b{483b6b9 V. E 330, 0-640, 88}
com.qq.e.comm.plugin.dl. A$c {dbc61cb V. E..... ....... 0, 14-310, 74}
com.q9.e.comm.plugin. M. c116a50c1 VE 20, 13-290, 46}
android.widget.TextView {d03ada8 V. ED 0, 0-112, 33}
android.widget.TextView {5256066 V. ED. 117, 0-153, 33}
android.widget.TextView {92d4fa7 V. ED. 158, 0-270, 33}
com.qq.e.d1.1.k. e. c {6db9080 G.E 0, 0-0, 0}
com.qq.e.d1. 1. k. e. c {b888e60 V. ED. . 0,0-0, 0}
com.qq.e.d1. 1. m. a. c{2c60f19 V. ED.. 0,0-0, 0}
com.qq.e.dl.1. k. e.c {d8870f7 V.ED.. ], 1076-720, 1204}
com.qq.e.comm.plugin. d1. s$c {77df4f6 V.E...... ........ 16, 71-672, 112}
android.widget.TextView {acd1d91 V.EI 0, 0-656, 41}
com.qq.e.d1. 1. m. b. o {b8d8b64 V. ED. 672, 93-704, 112]
com.qq.e.d1.1.k. e. c{40c6a82 V.E... 16, 768-704, 1128}
com.qq.e.d1.1.k.e.c {f1501cd V. ED. 0, 110-688, 360}
com.qq.e.d1. 1. m. a. c{4492593 V. ED. ... 24, 24-120, 120}
com.qq.e.d1. 1.k.e.clf1aacce V.E. 144, 24-588, 120}
com.qq.e.d1.1.k. f.b{37cedc9 V.E... ....... 0, 0-444, 48}
com.qq.e.d1.1.m. b. c{f49f9d0 V. ED 0, 0-160, 48}
com.qq.e.d1.1.k. f.b {3b8c7da V. E..
com.qq.e.dl. 1. m. b. c{c5d9d85 V. ED. 0, 0-349, 33}
com.qq.e.comm.plugin. d1. y$c {ed332e8 V. E..... ....... 24, 146-664, 226}
com.qq.e.comm.plugin. M. k {f2db40b V. ED.
com.qq.e.d1.1. m. b. c{df8d01 V. ED... 0, 0-640, 80}
com.qq.e.conm.plugin. d1. z$d {beb87a6 V. ED. . ), 1204-720, 1208}
com.qq.e.dl.1.k. e. c{cdf525f V. ED. . 0, 0-720, 1280}
com.qq.e.dl.1.m. a. c{e0e7fae V. ED. ... 0.0-720,1280}
com.qq.e.dl. 1.k. e. c{5a7914f V. ED. 0, 0-720, 1280}
com.qq.e.dl. 1.k. f. b{4fe35e5 V. E. 80, 233-640, 1046}
com.qq.e.dl. 1.m. a. c{8b920dc V. ED 192, 0-368, 176}
com.qq.e.d1. 1. m. b. c {8c6e8ba V. ED 170, 216-390, 268}
com.qq.e.dl.1.m. b. c{175f36b V. ED 105, 284-454, 317]
com.qq.e.dl. l.k. f.b{1614b61 V. E..
com.qq.e.d1.1.m. a. c {f256ec8 V. E
com.qq.e.d1.1.k. f.b {17e5b47
com.qq.e.d1.1. m. b. c {96ad686 V. 114, 0-189, 61}
40, 81-264, 113}
368, 0-432, 120}
com.qq.e.comm.plugin. dl. y$c {4bb64e3 v. E........... 0, 685-560, 813}
com.qq.e.comm.plugin. M.k {20dd512 v. E..... ...... 0, 0-560, 128}
com.qq.e.d1. 1.k. e. c{d0f0599 V............ 624, 88-680, 144}com.qq.e.d1. 1.k. e. c{5356c3f W.ED..... ....... 3, 3-53, 53}
Coordinate Conversion:
The coordinates listed in the hierarchy are relative to the parent view. To obtain the absolute coordinates of each view, you need to convert them using the following steps:
- Iterate through the list of views.
- For each view:
- If the coordinates are relative, add the parent view's coordinates to obtain the absolute coordinates.
- Store the absolute coordinates in an array.
Code Example:
public class Node {
private String type;
private Rect coordinates;
private String id;
// Constructor and getter/setter methods
// Convert relative coordinates to absolute coordinates
public void convertToAbsolute(Node parentNode) {
int parentLeft = parentNode.getCoordinates().left;
int parentTop = parentNode.getCoordinates().top;
int parentRight = parentNode.getCoordinates().right;
int parentBottom = parentNode.getCoordinates().bottom;
int absoluteLeft = parentLeft + coordinates.left;
int absoluteTop = parentTop + coordinates.top;
int absoluteRight = parentLeft + coordinates.right;
int absoluteBottom = parentTop + coordinates.bottom;
coordinates.set(absoluteLeft, absoluteTop, absoluteRight, absoluteBottom);
}
// Example code to parse the view hierarchy string and build a node tree
public static List<Node> parseString(String input) {
List<Node> nodeList = new ArrayList<>();
// Parse the string and build the node tree
// Iterate through the list of nodes, converting relative coordinates to absolute coordinates
for (Node node : nodeList) {
if (node.getCoordinates().left < 0) {
// Relative coordinates, convert to absolute coordinates
node.convertToAbsolute(node.getParentNode());
}
}
return nodeList;
}
}
Note: This example code provides a basic implementation for parsing the view hierarchy string and converting relative coordinates to absolute coordinates. The actual implementation might vary depending on the application's specific requirements.
This information can be valuable for understanding the layout of your application's UI, debugging issues, and making informed decisions about optimizing your application's performance. By analyzing the view hierarchy, you can identify potential areas where you can reduce view complexity or improve drawing performance.
原文地址: https://www.cveoy.top/t/topic/n0YI 著作权归作者所有。请勿转载和采集!