webview_flutter 键盘打开时页面缩小 - HarmonyOS 鸿蒙Next

webview_flutter 键盘打开时页面缩小 - HarmonyOS 鸿蒙Next

webview_flutter 键盘打开,页面缩小

2 回复
拉取flutter-engine仓库代码,找到https://gitee.com/openharmony-sig/flutter_engine/blob/dev/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformViewsController.ets文件:

将154行 onComplete.run(new PlatformViewBufferSize(physicalWidth, physicalHeight));

修改为 onComplete.run(new PlatformViewBufferSize(oldNodeWidth, oldNodeHeight));

重新编译出flutter.har包使用

更多关于webview_flutter 键盘打开时页面缩小 - HarmonyOS 鸿蒙Next的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html


针对“webview_flutter 键盘打开时页面缩小 - HarmonyOS 鸿蒙Next”的问题,这通常是由于WebView在键盘弹出时未能正确调整布局所致。以下是一些可能的解决方法:

  1. 修改代码:可以尝试修改PlatformViewBufferSize的相关代码。具体地,找到PlatformViewsController.ets文件,将onComplete.run(new PlatformViewBufferSize(physicalWidth, physicalHeight));修改为onComplete.run(new PlatformViewBufferSize(oldNodeWidth, oldNodeHeight));,然后重新编译使用。
  2. 适配UserAgent:检查并适配HarmonyOS的UserAgent。升级到API 11后,真机上Web组件的默认UserAgent可能已变更,H5网站需要增加对鸿蒙Web的UserAgent适配。

如果以上方法未能解决问题,可能是由于特定的应用环境或配置导致。此时,建议检查应用的其它相关设置,或查看是否有其他开发者遇到并解决了类似的问题。如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部