<?xml version="1.0" encoding="utf-8"?> <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" android:accessibilityEventTypes="typeAllMask|typeViewClicked|typeViewFocused|typeWindowStateChanged|typeWindowsChanged|typeContextClicked|typeWindowContentChanged" android:accessibilityFeedbackType="feedbackAllMask|feedbackGeneric|feedbackSpoken" android:accessibilityFlags="flagDefault|flagRetrieveInteractiveWindows|flagIncludeNotImportantViews" android:canPerformGestures="true" android:canRetrieveWindowContent="true" android:canRequestFilterKeyEvents="true" android:canRequestEnhancedWebAccessibility="true" android:notificationTimeout="100" />
然后就是getRootInActiveWindow()这个方法,这个方法只有在窗口发生改变的时候,获取子节点才不会为null