y***@qq.com
y***@qq.com
  • 发布:2024-02-27 17:10
  • 更新:2024-06-22 09:36
  • 阅读:459

uniapp x 怎么监听页面物理键盘按下?

分类:uni-app x

uniapp x 怎么监听页面物理键盘按下?

不是软键盘是蓝牙物理键盘,安卓模拟器中电脑键盘按下。

2024-02-27 17:10 负责人:无 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

可以通过UniActivityKeyEventCallback 监听实现

文档地址:https://doc.dcloud.net.cn/uni-app-x/uts/utsactivitycallback.html#UniActivityKeyEventCallback

y***@qq.com

y***@qq.com (作者)

uni-app-x的addeventlistener怎么使用?
https://doc.dcloud.net.cn/uni-app-x/dom/unielement.html#addeventlistener

y***@qq.com

y***@qq.com (作者)

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] } "} 
莫楠尘

莫楠尘

软键盘你能监听不?我这边keyup无响应

要回复问题请先登录注册