Hide Mouse Pointer on Android

点点圈 提交于 2019-12-23 07:28:20

问题


I'm writing a game for OUYA and Android and I'm using the trackpad on the OUYA controller. When ever you touch it a mouse pointer comes up and I can't find a way to hide it. I image this would be a problem for games on an Android netbook as well. Has anyone found a way to interact with the cursor instead of just listening for events?


回答1:


This won't hide the mouse, but it will at least help prevent touch events from interfering with your joystick processing code -- not a proper solution I know, but still might help people who land on this page:

public boolean onGenericMotionEvent(MotionEvent event) {
    if ( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
        //handle the event
        return true;
    }
    else {
        return false;
    }
}



回答2:


Android currently does not expose any functionality to hide the mouse cursor. Whenever you have an external pointing device (ie. usb/bluetooth mouse, trackpad, etc) a mouse pointer will appear on the screen whenever you interact with the device.

Unfortunately (as of JB 4.2.2) this means it is impossible without a modified ROM.



来源:https://stackoverflow.com/questions/14309425/hide-mouse-pointer-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!