发布网友 发布时间:2022-05-01 13:55
共4个回答
热心网友 时间:2023-07-31 04:14
KeyEvent: simulateKeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK, 0);public boolean simulateKeyEvent(int aiton, int keyCode, int repeatCount){ KeyEvent key = new KeyEvent(aiton, keyCode); if(aiton==KeyEvent.ACTION_DOWN){ return onKeyDown(key.getKeyCode(), key); } else if(aiton==KeyEvent.ACTION_UP){ return onKeyUp(key.getKeyCode(), key); } else { return onKeyMultiple(key.getKeyCode(), repeatCount, key); } }TouchEvent:MotionEvent EM = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, x, y, 1, 1, -1, 10, 10, 0, 0);; onTouchEvent(EM); EM.recycle();热心网友 时间:2023-07-31 04:14
1. InputConnection.sendKeyEvent()2. InputMethodService.sendDownUpKeyEvents(keyEventCode)都可以吧。热心网友 时间:2023-07-31 04:15
这个行吗 InputConnection.sendKeyEvent()热心网友 时间:2023-07-31 04:15
楼主,你这个问题解决了没有,能否共享下代码!!万分感谢