在软件设置鼠标位置 [英] Set mouse position in software

查看:259
本文介绍了在软件设置鼠标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Android棒(<一href="http://www.geekbuying.com/item/Uhost-2-Dual-Core-TV-Box-Mini-PC-Android-4-0-4-RK3066-Cortex-A9-1-6GHZ-1GB-RAM-4G-ROM-with-Bluetooth-WIFI-Skype-XBMC---Black-312467.html" rel="nofollow">http://www.geekbuying.com/item/Uhost-2-Dual-Core-TV-Box-Mini-PC-Android-4-0-4-RK3066-Cortex-A9-1-6GHZ-1GB-RAM-4G-ROM-with-Bluetooth-WIFI-Skype-XBMC---Black-312467.html)构建一个应用程序,该应用程序使用一个连接的USB摄像头的它的一些功能。此外,我将鼠标连接到该设备,用户可以用它来浏览应用程序中的各个页面。鼠标结果的左/右移动在导航previous /下一页。

I am using an Android Stick (http://www.geekbuying.com/item/Uhost-2-Dual-Core-TV-Box-Mini-PC-Android-4-0-4-RK3066-Cortex-A9-1-6GHZ-1GB-RAM-4G-ROM-with-Bluetooth-WIFI-Skype-XBMC---Black-312467.html) for building an application. The application uses an attached USB webcam for some of it's functionality. Additionally, I connect a mouse to this device which the user can use to navigate through various pages in the application. A left/right movement of the mouse results in navigation to previous/next page.

当鼠标工作原理与Android设备,我另外还需要与用户的每一次交互后,鼠标的位置重置为中心。是否有可能设置在Android中使用软件的鼠标的位置?我使用 View.OnGenericMotionListener 捕捉鼠标的移动。

While the mouse works with the Android device, I additionally require to reset the position of the mouse to the center after every single interaction with the user. Is it possible to set the mouse position using software in Android? I am using View.OnGenericMotionListener to capture the mouse movement.

目前,我还需要执行主鼠标按钮来将鼠标关注的应用程序中。我想通过删除这一要求无论是生成鼠标主按键,点击软件,或以其他方式通过其他方式带来的应用软件。

Currently, I also require to perform a primary mouse button click to bring the mouse in focus inside the application. I want to remove this requirement by either generating the primary mouse button click in software, or otherwise bring the application in software by some other means.

我一直无法找到任何的API来获取上述工作。在这些任何帮助将大大有益的。

I have been unable to find any APIs to get the above to work. Any help on these would be greatly useful.

以防万一我需要编写某种司机让这件事的工作,这方面的任何帮助,也将是有益的。

Just in case I need to write some sort of drivers to get this thing working, any help in this direction would also be useful.

解决此问题的任何变通方法,同时仍使用鼠标,也可以证明是有用的。

Any workarounds around this problem, while still using the mouse, could also prove useful.

推荐答案

鼠标事件是由系统框架进行管理。你不能在Java端控制它。

Mouse event is managed by the system framework. You cannot control it on Java side.

在亚行的shell,你可以打开/ dev /输入/ UEVENT设备编写的鼠标事件包括

On the adb shell you can open /dev/input/uevent device to write mouse events include

  1. 在相对运动
  2. 单击动作
  3. 在绝对位置(你可能想这一点)

但是,你不能这样做它作为一个正常的应用程序,除非你做了一个根深蒂固的设备上,也可以使用亚行的shell在后台启动一个后台程序服务来执行的情况下编写你的应用程序。

However, you cannot do it as a normal application, unless you do it on a rooted device, or you can use adb shell to start a daemon service in the background to perform the event writing for your application.

这篇关于在软件设置鼠标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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