最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Android WebView conflicting with imePadding - Stack Overflow

programmeradmin4浏览0评论

I've got an Android project using a WebView to display a WebApp. In this app, there are some text input fields. In order to avoid hiding the field while opening the keyboard, the .imePadding() has been added to the modifier of the WebView.

> WebView(
>      modifier = modifier.fillMaxSize(),
>      state = state,
>      client = object : AccompanistWebViewClient() { ... },
>      onCreated = { webView ->
>           webView.settings.cacheMode = WebSettings.LOAD_DEFAULT
>           webView.settings.domStorageEnabled = true
>           webView.settings.javaScriptEnabled = true
>           webView.clearCache(true)
>           webView.addJavascriptInterface(WebViewInterface {
>                onWebEventDecode(it)
>           }, "Interface")
>      }
> )

Issue is, that after opening a TextField and hiding the keyboard, any interaction with the WebView is disabled. For example, the integrated back button in the WebView receives the action (can see it throough the logs) but no action is executed.

Test without the .imePadding() option does not disable the interactions.

Do you guys have any idea why the WebView loses control over its interactions following a hideime() ?

I've tried to check in the view keeps the focus (it does, I could have checked it while logging the client). I've also tried several webview options like isNestedScrollingEnabled = true without success.

发布评论

评论列表(0)

  1. 暂无评论