https://doc.dcloud.net.cn/uni-app-x/plugin/uts-for-android.html#_4-2-1-getuniactivity
怎么重写dispatchKeyEvent事件
let decorView = UTSAndroid.getUniActivity()!.window.decorView;
console.log(decorView);
//打印{"dispatchGenericMotionEvent":"f () { [native code] } ","dispatchKeyEvent":"f () { [native code] } ","dispatchKeyShortcutEvent":"f () { [native code] } ","dispatchPointerCaptureChanged":"f () { [native code] } ","dispatchTouchEvent":"f () { [native code] } ","dispatchTrackballEvent":"f () { [native code] } ","draw":"f () { [native code] } ","gatherTransparentRegion":"f () { [native code] } ","getBackground":"f () { [native code] } ","getResources":"f () { [native code] } ","getWindowInsetsController":"f () { [native code] } ","isTransitionGroup":"f () { [native code] } ","onApplyWindowInsets":"f () { [native code] } ","onAttachedToWindow":"f () { [native code] } ","onConfigurationChanged":"f () { [native code] } ","onDetachedFromWindow":"f () { [native code] } ","onDraw":"f () { [native code] } ","onInterceptTouchEvent":"f () { [native code] } ","onLayout":"f () { [native code] } ","onMeasure":"f () { [native code] } ","onTouchEvent":"f () { [native code] } ","onWindowFocusChanged":"f () { [native code] } ","onWindowSystemUiVisibilityChanged":"f () { [native code] } ","sendAccessibilityEvent":"f () { [native code] } ","setBackgroundDrawable":"f () { [native code] } ","setOutlineProvider":"f () { [native code] } ","showContextMenuForChild":"f () { [native code] } ","startActionMode":"f () { [native code] } ","startActionModeForChild":"f () { [native code] } ","toString":"f () { [native code] } "}
4 个回复
DCloud_Android_DQQ
可以通过UniActivityKeyEventCallback 监听实现
文档地址:https://doc.dcloud.net.cn/uni-app-x/uts/utsactivitycallback.html#UniActivityKeyEventCallback
y***@qq.com (作者)
uni-app-x的addeventlistener怎么使用?
https://doc.dcloud.net.cn/uni-app-x/dom/unielement.html#addeventlistener
y***@qq.com (作者)
https://doc.dcloud.net.cn/uni-app-x/plugin/uts-for-android.html#_4-2-1-getuniactivity
怎么重写dispatchKeyEvent事件
莫楠尘
软键盘你能监听不?我这边keyup无响应