Android的磨损覆盖通行证上触摸事件 [英] Android Wear Overlay Pass on Touch Events

查看:207
本文介绍了Android的磨损覆盖通行证上触摸事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android Wear应用程序中,我使用一个透明的覆盖,以免费获赠触摸事件。我需要能够接受这种情况发生在屏幕上的任何位置的所有触摸事件,也能看到它们的坐标。

I have an Android Wear app in which I use a transparent overlay view to recieve touch events. I need to be able to receive all touch events that happen anywhere on the screen, and also be able to see their coordinates.

所有的研究,我发现说,我不能接受她所有的触摸事件,并通过他们的。然而,穿迷你发射器和< A HREF =htt​​ps://play.google.com/store/apps/details?id=com.wingoku.swipify.phone&hl=en相对=nofollow> Swipify 都做这样的事情这一点。

All research I have found says that I cannot recieve all touch events and pass them on. However, Wear Mini Launcher and Swipify are both doing something like this.

下面是我看过:

  • <一个href="http://stackoverflow.com/questions/9085022/android-overlay-to-grab-all-touch-and-pass-them-on">Android覆盖抓住所有的触摸,并通过他们?
  • <一个href="http://stackoverflow.com/questions/19356834/overlay-view-which-intercepts-some-events">http://stackoverflow.com/questions/19356834/overlay-view-which-intercepts-some-events
  • <一个href="http://stackoverflow.com/questions/6841971/android-intercept-and-pass-on-all-touch-events">Android - 拦截和传球上的所有触摸事件
  • <一个href="http://stackoverflow.com/questions/8073803/android-multi-touch-and-type-system-overlay">Android :多点触摸和TYPE_SYSTEM_OVERLAY
  • <一个href="http://stackoverflow.com/questions/4481226/creating-a-system-overlay-window-always-on-top?lq=1">Creating系统覆盖窗口(总在最前)
  • <一个href="http://stackoverflow.com/questions/6742177/getting-the-view-that-is-receiving-all-the-touch-events?lq=1">Getting正在接收所有的触摸事件的视图
  • <一个href="http://stackoverflow.com/questions/15737861/android-jelly-bean-service-that-receives-all-touch-events?lq=1">Android接收所有触摸事件
  • 果冻豆服务
  • TYPE_SYSTEM_OVERLAY在ICS
  • <一个href="http://stackoverflow.com/questions/25917844/overlay-app-that-reacts-only-on-some-touch-events?lq=1">Overlay应用程序只有反作用于某些触摸事件
  • Android overlay to grab ALL touch, and pass them on?
  • http://stackoverflow.com/questions/19356834/overlay-view-which-intercepts-some-events
  • Android - Intercept and pass on all touch events
  • Android : Multi touch and TYPE_SYSTEM_OVERLAY
  • Creating a system overlay window (always on top)
  • Getting the View that is receiving all the touch events
  • Android Jelly Bean service that receives all touch events
  • TYPE_SYSTEM_OVERLAY in ICS
  • Overlay App that reacts only on some touch events

这一定是可以做到的某种方式。也许叠加的观点是不正确的方式来处理这个?任何指针?

This must be possible to do somehow. Maybe an overlay view is not the right way to approach this? Any pointers?

推荐答案

我有相当多的麻烦,这一点使用您所提供的相同的链接,以及。但后来我发现这一点: http://www.piwai.info/chatheads-basics/

I had quite a bit of trouble with this as well using the same links that you provided. But then I found this: http://www.piwai.info/chatheads-basics/

这是基本相同的其他解决方案,除了参数的窗口管理器 的LayoutParams TYPE_PHONE FLAG_NOT_FOCUSABLE

It's basically the same as the other solutions, except that the arguments to the WindowManager LayoutParams are TYPE_PHONE and FLAG_NOT_FOCUSABLE.

不仅为我做的这个解决方案的工作(我在测试上LG文雅),在的onTouchEvent 回调了所有的动作(下降,移动及以上),其中,其他的解决方案说你不会得到的。

Not only did this solution work for me (I was testing on an LG Urbane), the onTouchEvent callback had all the actions (down, move, and up), which the other solutions said you wouldn't get.

由于所有的触摸事件是通过看得见的地方经过,理论上我们可以用手势探测器获得的回调,像双水龙头和飞灰湮灭。我没有试过呢,虽然。

Since all the touch events are passed through the view, in theory we can use gesture detectors to get callbacks for things like double taps and flings. I haven't tried this yet, though.

无论如何,上面的链接应该让你过去,你所面临的最初的问题。

Regardless, the above link should get you past the initial problems you're facing.

这篇关于Android的磨损覆盖通行证上触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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