Disable trackball click in Android

半世苍凉 提交于 2019-11-28 14:14:50

Check the onTrackballEvent() method. Then try to directly returning true in the method without doing anything in it. This should kill the event right away.

In order to prevent your trackball doing anything while your activity is on screen, add the following code to your Activity subclass.

@Override 
public boolean dispatchTrackballEvent(android.view.MotionEvent ev) {
  return true;
};

I've tested this on a Google Nexus One phone and it works fine.

Override onTrackballEvent() does not work. Try overriding dispatchTrackballEvent(), do nothing in it just return true;.

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