Android 如何模拟返回键、菜单键、主页键?

xiaoxiao2021-02-28  64

如果有一个悬浮窗,运行所有程序的时候都能够看到,我希望点击悬浮窗就模拟返回键的功能,不管我现在运行的是什么程序,这个如何实现?   方法一: Runtime runtime = Runtime.getRuntime(); runtime.exec("input keyevent " + KeyEvent.KEYCODE_BACK);   方法二: Instrumentation inst = new Instrumentation(); inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
转载请注明原文地址: https://www.6miu.com/read-53360.html

最新回复(0)