androidandroid-studioandroid-windowmanagerlayout-inspector

How do I provide a ViewRootImpl name to Layout Inspector?


I'm inflating four Views and adding them to the WindowManager using the addView method in the ViewManager. I'm using Android Studio's Layout Inspector to debug the layout of the views, however when I pull up the list of views in that process I get a list of ViewRootImpls. To make it easier to find the right view, I would like to provide a name that Layout Inspector can find and show instead of the class and the address.

For most of these views, the root layout that I inflate is a container, e.g. ConstraintLayout. Still, that class name isn't resolved, but rather it just shows ViewRootImpl.

I've tried setting a tag on the view, but that did not do anything. I used a hex editor to look at the captured li file and at the top of it sits a "title" tag. I therefore tried to set the title in the WindowManager.LayoutParams used when adding the view, but that didn't do anything.

How do I provide this information to Layout Inspector?

enter image description here


Solution

  • My bad, setting the title in WindowManager.LayoutParams worked after all.