onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', async (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
/**
* 实现键盘避让
*/
const win = await windowStage.getMainWindow()
win.getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE)
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
鸿蒙实现键盘僻壤
于 2024-05-31 10:56:26 首次发布