解释ClickableViewAccessibility [英] Explain ClickableViewAccessibility

查看:8577
本文介绍了解释ClickableViewAccessibility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SO刷卡code ,Android的皮棉给了警告

Concerning the SO swipe code, Android lint gave the warning

OnSwipeTouchListener#onTouch应该调用查看#performClick当检测到点击[ClickableViewAccessibility]

OnSwipeTouchListener#onTouch should call View#performClick when a click is detected [ClickableViewAccessibility]

在警告的的描述,它说:

In the description of the warning, it says:

如果它覆盖onTouchEvent或使用一个OnTouchListener看法不还
  实施performClick和检测到点击时调用它,该视图可能不
  正确处理无障碍行动。逻辑处理单击操作应
  最好放置在浏览#performClick一些辅助功能服务调用
  performClick何时要发生点击动作。

If a View that overrides onTouchEvent or uses an OnTouchListener does not also implement performClick and call it when clicks are detected, the View may not handle accessibility actions properly. Logic handling the click actions should ideally be placed in View#performClick as some accessibility services invoke performClick when a click action should occur.

你是如何处理无障碍行动正确?

How do you "handle accessibility actions properly"?

推荐答案

该警告的出现是因为code监听 onTouchEvent (见的文档,点3 )。有一个指向一个click事件的解决方案的,但并没有解决轻扫是否需要被处理或不

The warning arises because the code listens for onTouchEvent (see docs, point 3). There is a pointer to a solution for a click event, but that does not address whether a swipe needs to be handled or not.

一个解决方法是使用触发相同的动作轻扫事件按钮。然后,使用 @燮pressWarnings

A workaround would be to use buttons that trigger the same action as the swipe event. Then, to use @SuppressWarnings.

这篇关于解释ClickableViewAccessibility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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