android - 如何检查用户是否触摸了什么?

标签 android android-toolbar android-window

我想知道用户何时与我的应用进行交互。我已尝试使用 Window.Callback,但我遇到了 Toolbar 的问题。

如果我们调用 setSupportActionBar (setActionBar),我的 Window.Callback 将不再接收事件。

限制:

我无法扩展 Activity。我需要一个全局位置来处理与应用程序的所有交互。

最佳答案

尝试 onUserInteraction() .

Called whenever a key, touch, or trackball event is dispatched to the activity. Implement this method if you wish to know that the user has interacted with the device in some way while your activity is running.

关于android - 如何检查用户是否触摸了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55470754/

相关文章:

php - 同步数据库 sqlite 与 mysql

android - 如何在android中以编程方式创建alertdialog

android - 在工具栏或操作栏的中心设置 ActionBarDrawerToggle,android?

android - 获取弹出窗口内 View 的绝对坐标

android - 在 Android 中设置 FLAG_LAYOUT_IN_SCREEN 后禁用全屏模式

android - 如何删除我授予自己的 Android OAuth2 权限

android - Espresso,使用登录屏幕测试快乐路径

android - 什么是安卓窗口?

android - 如何在 Pre-Lollipop 版本中更改工具栏文本颜色

c# - Xamarin Android 工具栏如何动态添加项目