Android Question How do I disable keyboard for webview?

Dominic Phillips

New Member
Licensed User
Longtime User
Hi,

If I change focus from an edit box to a webview the keyboard stays open and causes the whole screen to scroll up which looks awful in my app.

If you click directly into the webview then no keyboard. Edit box followed by webview and it stays.

I can use IME to hide the keyboard on lost focus, but it looks clunky. Ideally I would like to disable the keyboard from the webview under any circumstances.

Any help would be hugely appreciated.

(project attached)

Thanks
 

Attachments

  • WebViewIssue.zip
    351.2 KB · Views: 191

Dominic Phillips

New Member
Licensed User
Longtime User
You can disable the automatic panning mode with this manifest editor line:
B4X:
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)


Hi Erel,

A big, big thank you for your quick response. In fact I solved the issue another way using another post your provided for a separate issue.

The best option was to disable the ability for the webview to take the focus as it doesn’t need to for my purposes (I’m displaying a database table).

Hence:

Dim r As Reflector

r.Target = webview

r.RunMethod2("setFocusable", "false", "java.lang.boolean")


solved my problem.

Thanks again
 
Upvote 0
Top