0

I am stuck at figuring out how to get the double tap even on proximity sensor. Since proximity sensor gives only true or false value how do I check if there is a continuation to form a double tap gesture ? I have found some of similar questions but no definite responses in terms of actual code. any example code would be very helpful!

4

1 回答 1

0

实现你自己的监听器。当传感器值由远变近时,查看上次由远变近是什么时候。如果时间差在您的双击阈值之内,则执行双击操作。确保在检测到双击后重置时间,以便三次点击不会触发第二次双击事件。您应该使用SystemClock.elapsedRealtime()来确定点击之间的时间。您也可以使用 android 默认的双击超时,请参阅ViewConfiguration.getDoubleTapTimeout()

于 2014-09-05T17:58:27.603 回答