【发布时间】:2019-10-21 16:19:44
【问题描述】:
这是我在 NativeScript + Vue 中的 app.js:
import Vue from "nativescript-vue";
new Vue( {
template: `<Frame actionBarVisibility="never" ></Frame>` ,
methods: {
fullScreenApplier () {
var app = require("application");
var platform = require("platform");
var View = android.view.View;
if ( app.android && platform.device.sdkVersion >= '21' ) {
var window = app.android.startActivity.getWindow();
var decorView = window.getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
);
}
}
} ,
mounted () { this.fullScreenApplier(); }
} ).$start();
它隐藏了StausBar,但如果我最小化应用程序并再次返回到它,StatusBar 将永久保持在顶部,除非我将其杀死。
这里有什么问题?
【问题讨论】:
-
在Frame的loaded事件上尝试调用
fullScreenApplier()方法。 -
@Manoj 非常感谢,您能根据您的建议解释为什么它可以正常工作吗?我什至试图通过点击来调用它,但它没有帮助。
-
Loaded 事件在恢复时也会被调用,因此它会将 Activity 的设置应用回来。
标签: vue.js nativescript android-statusbar android-fullscreen