```
import { KeyboardAvoidMode } from '@ohos.arkui.UIContext';
onWindowStageCreate(windowStage){
windowStage.loadContent('pages/Index', (err, data) => {
let a = windowStage.getMainWindowSync().getUIContext().getKeyboardAvoidMode();
windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.OFFSET);
if (err) {
Logger.error(TAG, `Failed to load the content. Cause: ${JSON.stringify(err)}`)
return
}
Logger.info(TAG, `Succeeded in loading the content. Data: ${JSON.stringify(data)}`)
})
}
```
在应用MainAbility/MainAbility.ts文件中实现
[/md]作者: mean 时间: 2024-4-7 11:42
学习了