通过adb,我试图确定是否有一种方法可以为用户指定的显示获取层次结构转储。目前,可以通过adb完成以下操作
uiautomator转储
这将生成默认屏幕的xml转储。我假设是0号屏幕。但是我没有看到uiautomator用于指定显示id的任何参数。例如,录屏应用允许-d参数指定屏幕,而不是默认的0。
录屏-d 1
那么,如何获得显示id为1的层次结构转储?
发布于 2021-09-05 17:11:54
考虑到uiautomator转储活动窗口的UI (请参见source code) ),一种可能的解决方法是以编程方式在特定显示上启动一些应用程序,以便设置焦点并转储UI层次结构:
adb shell am start com.google.android.calendar --display 0
adb shell uiautomator dump /sdcard/window_dump0.xml
adb pull /sdcard/window_dump0.xml并对辅助显示重复相同的步骤,您将获得相应的UI层次结构:
adb shell am start com.google.android.calendar --display 1
adb shell uiautomator dump /sdcard/window_dump1.xml
adb pull /sdcard/window_dump1.xmlhttps://stackoverflow.com/questions/65078563
复制相似问题