【问题标题】:Accessibility service click on custom view not working (performClick not overridden)辅助功能服务单击自定义视图不起作用(未覆盖执行单击)
【发布时间】:2018-10-30 08:55:24
【问题描述】:

如何从 Accessibility Service 中单击自定义视图(iOS 样式的开关),其中 onTouchEvent 方法被覆盖,但 performClick 没有。我在服务中创建了一种调试方法,通过单击视图在日志中显示所有事件。当我单击除此自定义视图之外的所有按钮时,日志中会显示。如果您通过 id 找到视图并从 AccessibilityService 调用 performAction(CLICK),它绝对不会响应。我知道可以使用 dispatchGesture 并模拟滑动,但它仅适用于 Android 7.0 (api 24)。这种情况有什么解决方法吗?提前感谢您的任何提示。 无障碍服务配置:

<?xml version="1.0" encoding="utf-8"?>
<accessibility-service
xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeWindowStateChanged|typeWindowContentChanged"
android:accessibilityFlags="flagDefault|flagIncludeNotImportantViews|flagReportViewIds|flagRequestTouchExplorationMode"
android:canRetrieveWindowContent="true"
android:notificationTimeout="100"
android:canRequestTouchExplorationMode="true"
android:canPerformGestures="true"
android:settingsActivity="com.example.helper.MainActivity"/>

【问题讨论】:

    标签: android accessibilityservice accessibility


    【解决方案1】:

    不幸的是,我不相信有解决方法。辅助功能服务依赖于应用程序共享有关它们显示的 UI 的信息。如果应用程序不公开此类操作,那么您实际上无法恢复信息。

    即使使用手势调度 API,您也不确定哪些视图是可操作的。

    【讨论】:

      猜你喜欢
      • 2022-11-30
      • 2015-08-11
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      • 2013-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多