uni-app hbuildx 新版 安卓横屏无法触发uni.onKeyboardHeightChange事件,而且会弹出异形输入框,旧的版本4.36没问题

uni-app hbuildx 新版 安卓横屏无法触发uni.onKeyboardHeightChange事件,而且会弹出异形输入框,旧的版本4.36没问题

1 回复

更多关于uni-app hbuildx 新版 安卓横屏无法触发uni.onKeyboardHeightChange事件,而且会弹出异形输入框,旧的版本4.36没问题的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这是一个已知的引擎兼容性问题,建议按以下步骤排查:

  1. 确认HBuilderX版本,建议升级至最新稳定版(当前3.8.12+)
  2. 在manifest.json中检查"safearea"配置,建议启用全面屏适配:
"app-plus": {
    "safearea": {
        "bottom": {
            "offset": "none"
        }
    }
}
  1. 横屏模式下需要额外处理键盘事件,建议在页面onLoad时添加:
// #ifdef APP-PLUS
plus.screen.lockOrientation("landscape");
// #endif
  1. 临时解决方案可监听窗口尺寸变化:
uni.onWindowResize((res) => {
    console.log('窗口尺寸变化', res)
})
回到顶部