简体   繁体   中英

android view hierarchy with resource id

is there a way to get the hierarchy of the current layout of the device along with the resource id of the elements in the hierarchy?

I found a way to get the hierarchy but the IDs of the elements weren't there.

Also, note that i'm not doing that from inside the application with the current layout.

View has method: getParent() and getId(). ViewGroup hasMethod: getChildren(). It is enough to get full hierarchy. If you want to find out View hierarchy of elements in layout you should inflate this layout using LayoutInflater.

Another solution is to create your own xml parser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM