事件未传递给侦听器 [英] Event not delivered to listener

查看:32
本文介绍了事件未传递给侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 一个使用 scene2d 的 libgdx 游戏代码> 用于 UI.我有几个带有自己的 ClickListenerImageButton 实例.在某些设备上(目前仅在三星 Galaxy S3 和三星 Galaxy S4 Active 上看到过)存在事件无法传递的问题,除非快速单击两次.

I have a libgdx game that uses scene2d for the UI. I have several ImageButton instances with its own ClickListener. On some devices (only seen it on Samsung Galaxy S3 and Samsung Galaxy S4 Active so far) there is a problem with the event not being delivered unless one clicks twice quickly.

每次点击失败都会记录如下内容:

Every time a click fails something like the following is logged:

04-22 16:10:09.678: D/InputReader(728): Input event: value=1 when=20897610551000
04-22 16:10:09.678: I/InputReader(728): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.889 ] when=20897610612000
04-22 16:10:09.678: I/InputDispatcher(728): Delivering touch to: action: 0x0
04-22 16:10:09.678: I/InputDispatcher(728): Delivering touch to: action: 0x3
04-22 16:10:09.688: W/InputEventReceiver(728): Attempted to finish an input event but the input event receiver has already been disposed.
04-22 16:10:09.688: W/InputEventReceiver(728): Attempted to finish an input event but the input event receiver has already been disposed.
04-22 16:10:09.688: V/WindowManager(728): Window{43478730 u0 Keyguard}mOrientationRequetedFromKeyguard=false
04-22 16:10:09.698: D/STATUSBAR-StatusBarManagerService(728): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
04-22 16:10:09.788: D/InputReader(728): Input event: value=0 when=20897720902000
04-22 16:10:09.788: I/InputReader(728): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=20897720902000

我假设语句 Attempted to finish an input event 但输入事件接收器已被释放. 是这里的关键,但我真的不明白为什么再单击一次它会起作用时间很快.

I assume the statement Attempted to finish an input event but the input event receiver has already been disposed. is key here, but I can't really see why it would work when one click one more time quickly.

这可能是什么原因?我怎样才能进一步调试它以深入了解它?有什么线索吗?

What could the reason for this be? How can I debug this further to get to the bottom of this? Any clues?

除了最后两个之外的所有日志行都出现在 touch down 时,而最后两个出现在 touch up 时.我的事件监听器用于点击.

All log lines except the two last ones appears on touch down, while the last two appears on touch up. My event listener is for on click.

推荐答案

我找到了导致问题的原因.我遇到了 KitKat 中的音量按钮错误的问题,并且有添加了变通方法的变体(https://stackoverflow.com/a/21253443/467650https://plus.google.com/+MichaelLeahy/posts/CqSCP653UrW).

I found out what was causing the problem. I had issues with the volume button bug in KitKat and had added a variant of the workarounds (https://stackoverflow.com/a/21253443/467650, https://plus.google.com/+MichaelLeahy/posts/CqSCP653UrW).

我能够通过减少运行删除导航栏的处理程序之前的时间延迟来解决我的双点触摸"问题,但是这对于 KitKat 来说还是不够好.我当然可以检查运行该应用程序的 Android 版本,但由于解决方法一开始真的很麻烦,所以我将其全部删除.

I was able to get around my "double touch" problem by decreasing the time delay before running the handler that removes the navigation bar, but that again didn't work well enough with KitKat. I could of course check the Android version of the running the app, but as the workaround is really hacky to begin with I removed it all together.

这篇关于事件未传递给侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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