I have an app that is basically just a WebView. I want to only accept input from a hardware keyboard. I haven't figured out a way to hide/disable the Android soft keyboard without also disabling the hard keyboard as well.
This code strangely allows the text fields to be focused and the cursor shows in the field, however I cannot type any characters:
<WebView
android:id="@+id/webview"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
I've tried many things but nothing seems to work. I'm feeling like this is not possible to do but it sounds like something that should be.
Thanks in advance
Please see Android Team answer here:
Disable SoftKeyboard inside a WebView
Add following code in main(parent) layout in your layout.xml
android:descendantFocusability="blocksDescendants"
and set following property in your webview
android:focusable="false" android:focusableInTouchMode="true"
If that also blocks your hardware keyboard then this other method should work for you:
How to hide keyboard when user clicks on textbox in webview android
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.