How to hide keyboard when user clicks on textbox in webview android

我的梦境 提交于 2019-12-01 05:58:01
Yvette Colomb

You can control the softkeyboard - Handling Input Method Visibility for each activity with the manifest like so:

<activity
    android:name=".Main"
    android:windowSoftInputMode="stateAlwaysHidden" >

<activity
    android:name=".Main"
    android:windowSoftInputMode="stateHidden" >

You can also control it so it flows using 'next' from one edittext to the next and then hides again with 'done' using IME options.

android:imeOptions="actionNext"
android:imeOptions="actionDone"

I also realise the problem would be with using a webview and needing to also disable any keyboard from parent layouts,as the webview is separate from the activities in the manifest, so add this to any parent layout:

android:descendantFocusability="blocksDescendants"

and in the webview:

android:focusable="false" 
android:focusableInTouchMode="false"

try this in the activity in manifest.xml..

android:windowSoftInputMode="stateHidden"

it may help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!