Android:WebView 旋转阻止键盘打开

发布于 2024-11-30 22:05:22 字数 995 浏览 0 评论 0原文

由于某些特定需求,我在一个活动上有一个 WebView,其旋转由我管理(清单:android:configChanges="keyboardHidden|orientation")。

出于测试目的,我在其上打开 Google.com。

第一次,Google.com 打开一切都很好。但是,在我旋转设备后,焦点事件似乎停止工作。

当按下 Google.com 的搜索框时,软键盘打不开...甚至 LogCat 上也没有显示任何事件。

在旋转之前,这些是按 google.com 搜索框且键盘打开时出现的日志:

08-19 11:13:19.765: INFO/KeyInputQueue(2497): Input event
08-19 11:13:19.765: DEBUG/KeyInputQueue(2497): screenCaptureKeyFlag setting 0
08-19 11:13:19.769: ERROR/KeyLedTest(2581): KeyLedTest++
08-19 11:13:19.773: ERROR/KeyBoardLed(2497): UpdateState../sys/class/sec/keyboard/keyboard_led state false
08-19 11:13:19.773: ERROR/KeyBoardLed(2497): UpdateState../sys/class/sec/keyboard/keyboard_led state false finished
08-19 11:13:19.773: ERROR/KeyLedTest(2581): service.UpdateState0

旋转后,按时不显示任何日志...

我尝试查看是否调用了 onConfigurationChanged 方法,当按下搜索框时却没有。我还尝试从清单中删除键盘 android:configChanges="orientation" 但没有任何效果。

有人有任何线索吗?

I have a WebView on an activity that the rotation is managed by me (Manifest: android:configChanges="keyboardHidden|orientation") due to some specific needs.

For testing purposes i'm opening Google.com on it.

The first time, that Google.com opens it all works great. But, after I rotate the device, the focus events seem to stop working.

When pressing the search box of Google.com the soft keyboard doesn't open... there are even no events shown on the LogCat.

Before the rotation these are the logs that appear when pressing google.com search box and the keyboard is opening:

08-19 11:13:19.765: INFO/KeyInputQueue(2497): Input event
08-19 11:13:19.765: DEBUG/KeyInputQueue(2497): screenCaptureKeyFlag setting 0
08-19 11:13:19.769: ERROR/KeyLedTest(2581): KeyLedTest++
08-19 11:13:19.773: ERROR/KeyBoardLed(2497): UpdateState../sys/class/sec/keyboard/keyboard_led state false
08-19 11:13:19.773: ERROR/KeyBoardLed(2497): UpdateState../sys/class/sec/keyboard/keyboard_led state false finished
08-19 11:13:19.773: ERROR/KeyLedTest(2581): service.UpdateState0

After rotating none is shown when pressing...

I've tried to see if onConfigurationChanged method is called, when pressing the search box but it is not. I've also tried to remove the keyboard from Manifest being android:configChanges="orientation" but none has taken any effect.

Any clue someone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满意归宿 2024-12-07 22:05:22

也许您的 WebView 没有焦点?

有人提出了类似的问题:为什么 Android WebView 拒绝用户输入?
解决方案是添加以下行:

webView.requestFocus(View.FOCUS_DOWN);

Maybe your WebView is not having focus?

A similar question has been asked: Why is Android WebView refusing user input?
and the solution was to add the following line:

webView.requestFocus(View.FOCUS_DOWN);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文