gpt4 book ai didi

安卓触摸跟踪

转载 作者:行者123 更新时间:2023-11-30 04:36:59 24 4
gpt4 key购买 nike

我有一个主要 Activity ,以及许多扩展主要 Activity 的其他 Activity 。我想跟踪子 Activity 中的所有触摸事件,如单击按钮、 ListView 项、textView..等。但我无法做到这一点。我在主要 Activity 中实现了 onTouchEvent(MotionEvent 事件),

@Override
onTouchEvent(MotionEvent event)
public boolean onTouchEvent(MotionEvent event) {
System.out.println("onTouchEvent pressed");
return super.onTouchEvent(event);
}

但是这个函数没有被调用..有什么想法吗?

最佳答案

看看https://github.com/commonsguy/cw-advandroid/blob/master/Tapjacking/Jackalope/src/com/commonsware/android/tj/jackalope/Tapjacker.java.

它是一个为窗口管理器添加透明View的服务。该服务还实现了一个 onTouchListener。监听器将在应用运行时跟踪所有触摸事件。

它可能是最容易实现的,并且提供了一个中心位置来跟踪触摸事件。

关于安卓触摸跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6689990/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com