场景:flutter嵌入网页用的webview_flutter 发现在android下软键盘无法弹出,不能输入内容。

报错信息:

onWindowFocusChanged hasWindowFocus true
W/cr_IMM  (22042): Activity's display ID(28) does not match context's display ID(0). Using a workaround to show soft input on the correct display...
V/InputMethodManager(22042): b/117267690: Display ID mismatch found. ViewRootImpl displayId=30 InputMethodManager displayId=28. Use the right InputMethodManager instance to avoid performance overhead.

解决方法:

在页面初始化的时候加上这一行代码

if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();

代码示例:

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐