Android-在AccessibilityService中未调用onGesture方法 [英] Android - onGesture method not getting called in AccessibilityService

查看:120
本文介绍了Android-在AccessibilityService中未调用onGesture方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的可访问性资源的元数据资源:

This is my meta-data resource for the accessibility resource:

<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityFeedbackType="feedbackAllMask"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFlags="flagIncludeNotImportantViews"
android:canRetrieveWindowContent="true"
android:canRequestTouchExplorationMode="true"
android:canRequestFilterKeyEvents="true"
/>

我的无障碍服务类代码

public class MyAccessibilityService extends AccessibilityService {

@Override
protected void onServiceConnected() {
    super.onServiceConnected();
    Log.d("caller","service connected");
}

@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    Log.d("caller","onAccessibilityEvent Called");
}
@Override
protected boolean onGesture(int gestureId) {
    Log.d("caller","on guesture called");
    return super.onGesture(gestureId);
}

我尝试将accessebilityFlags设置为flagRequestFingerprintGestures,但仍然无法正常工作.

I have tried setting accessebilityFlags to flagRequestFingerprintGestures still it didn't work.

推荐答案

手势事件仅以触摸浏览模式发送.我看到您已经在xml中启用了此功能,但是在您实际要求将其打开的代码中却看不到.

Gesture events are only sent in touch exploration mode. I see that you have enabled this feature in your xml, but I don't see the code where you actually request that it get turned on.

这是您需要添加到xml中的标志

This is a flag that you need to add to your xml

android:accessibilityFlags="flagIncludeNotImportantViews|flagRequestTouchExplorationMode"

这篇关于Android-在AccessibilityService中未调用onGesture方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆