简体   繁体   中英

SAPUI5 - How to disable soft keyboard on android when focus is set on input field

I have a SAPUI5 scan web app which sets focus on an input field every time you click anywhere on the screen or leave the menu. This makes sure it is ready to display the scanned value in the input field.

The problem is that when the focus is set to the input field, the soft keyboard is displayed. I only want the soft keyboard to be displayed when the user specifically clicks on the input field.

My current solution is to disable the input, focus on the input and then enable the input field:

scannedInput.setEditable(false);
scannedInput.focus();
setTimeout(function () {
    scannedInput.setEditable(true);
}, 50);

The problem with this solution is that the screen flickers when this happens, as the keyboard appears and disappears.

Does anyone know a better solution?

Thanks

As far as I know there is no way to do this in JS/UI5 but most Android Keybords have a setting to disable the virtual keyboard like so:

Android Keyboard

Disable keyboard

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM