简单键盘是不具有任何智能功能的键盘。在EntryAbility.ets文件的onWindowStageCreate方法中调用inputMethod.setSimpleKeyboardEnabled(true),即可启用简单键盘模式。相关代码如下:
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
AppStorage.setOrCreate('windowStage',windowStage);
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
return;
}
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
// Settings Simple Keyboard
let enable: boolean = true;
inputMethod.setSimpleKeyboardEnabled(enable);
});
}