HarmonyOS 鸿蒙Next 无法监听软键盘的显示隐藏
无法监听软键盘的显示隐藏 inputMethodEngine.getInputMethodAbility().on(‘inputStart’)、.on(‘inputStop’)无法监听软键盘的显示隐藏 Demo如下:
[@Entry](/user/Entry)
[@Component](/user/Component)
struct Index {
aboutToAppear(): void {
try {
inputMethodEngine.getInputMethodAbility()
.on('inputStart', (kbController: inputMethodEngine.KeyboardController, client: inputMethodEngine.InputClient) => {
let keyboardController = kbController;
let inputClient = client;
console.log('输入法显示了');
});
inputMethodEngine.getInputMethodAbility().on('inputStop', () => {
console.log('inputMethodAbility inputStop');
console.log('输入法隐藏了');
});
} catch(err) {
console.error(`Failed to InputMethodEngine: ${JSON.stringify(err)}`);
}
}
build() {
Column() {
TextArea({placeholder: '无法监听输入法显示隐藏'}).width('100%')
.height(200)
.backgroundColor(Color.Pink)
}
}
}
更多关于HarmonyOS 鸿蒙Next 无法监听软键盘的显示隐藏的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
inputMethodEngine属于输入法框架的接口,仅对系统应用、输入法应用开放;其他三方应用无法使用
更多关于HarmonyOS 鸿蒙Next 无法监听软键盘的显示隐藏的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html