How to disable physical keyboard in code(use virtual keyboard all the time)

后端 未结 6 2081
迷失自我
迷失自我 2020-12-14 08:27

You might ask why do I want that. Here is the reason:

I used a barcode scanner for the login screen of my application. However connecting the barcode scanner will fo

6条回答
  •  猫巷女王i
    2020-12-14 09:02

    This appears to have some revelance to your case. From the Configuration class documentation.

    public int hardKeyboardHidden --- Added in API level 3

    A flag indicating whether the hard keyboard has been hidden. This will be set on a device with a mechanism to hide the keyboard from the user, when that mechanism is closed. One of: HARDKEYBOARDHIDDEN_NO, HARDKEYBOARDHIDDEN_YES.

    You can take some action on this config change. But I think there is no way to disable the physical keyboard in android.

    Update

    There the mHardKeyboardSwitch is a private member that holds a reference to the SwitchView which is used to reflect user's hardware keyboard preference. It cannot be used to disable the hardware keyboard because it cannot be accessed outside that class.

提交回复
热议问题