【问题标题】:StatusBar gets Back after returning back to the app, why?返回应用后状态栏返回,为什么?
【发布时间】: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


【解决方案1】:

按照@Manoj 的建议,在@loaded 中调用fullScreenApplier()

但是还有一个问题,

当我这样称呼它时:

permissionApplier () {
   permissions.requestPermission ( [
      "android.permission.INTERNET" ,
      "android.permission.READ_EXTERNAL_STORAGE"
   ] );
}

它再次返回StatusBar

我可以为这个问题做些什么?

【讨论】:

  • 您是在本地应用还是 Playground 上进行测试?
猜你喜欢
  • 2018-05-23
  • 2012-03-12
  • 1970-01-01
  • 2016-03-16
  • 2011-01-01
  • 2011-07-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多