智能客服
你问我答,随时在线为你解决问题
按下外接键盘CapsLock键,输入字母不是大写而是小写。

根据Hilog日志定位,查看日志关键字CapsLockState,日志CapsLockState为false,判断应用未使能CapsLock键。
- A000FF/i.hmos.inputmethod:inputMethod/HMKeyboard_HardwareInputManager: onInputStart. check result currentCapsLockState: false, this.subType?.id: InputEnLowerService
应用未使能CapsLock键。
参考以下代码使能CapsLock键:
- import { inputDevice } from '@kit.InputKit';
- import { BusinessError } from '@kit.BasicServicesKit';
-
- @Entry
- @Component
- struct SetKeyEnabled {
- aboutToAppear() {
- try {
- inputDevice.setFunctionKeyEnabled(inputDevice.FunctionKey.CAPS_LOCK, true).then(() => {
- console.info(`Set capslock state success`);
- }).catch((error: BusinessError) => {
- console.error(`Set capslock state failed`, error);
- });
- } catch (error) {
- console.error(`Set capslock enable error`);
- }
- }
-
- build() {
- Row() {
- TextInput()
- }
- .height('100%')
- .width('100%')
- .padding(16);
- }
- }