androidaccessibilityandroid-custom-viewandroid-uiautomatorview-hierarchy

android view hierarchy does not capture the custom view widget tree structure


I am trying to use DDMS hierarchy viewer to capture the virtual view hierarchy (tree structure of the custom view widget). This custom view widget is from android's sample code ApiDemos which has the accessibilityNodeProvider implemented. the thing is when hierarchy viewer and UiAuotmatorViewer do not capture the custom view widget's tree structure. It only shows the whole custom view as a single view object. I would really appreciate any inputs here. Desperately need some helps.


Solution

  • after debugging..and i found out that this is as simple as just adding a single line of codes which is missing in the sample. Add info.setVisibleToUser(true); right before you return the AccessibilityNodeInfo will enable view hierarchy tool to see the tree structure of this custom view.