|
1、打开相应工程,如下图1,找到在src/main/js/MainAbility/app.js文件,在onCreate函数中添加如下代码(红色部分),实现全屏效果
代码:
(1)
import window from '@ohos.window';
onCreate() {
var windowClass = null;
let promise = window.getTopWindow();
promise.then((data)=> {
windowClass = data;
console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data))
}).then(()=>{
windowClass.setFullScreen(true)
this.windowFull=true
console.info('Succeeded in obtaining the top window. Data: ')
})
}
2、参考网址:https://www.51cto.com/article/740484.html
|
|