简体   繁体   English

Android:phonegap / cordova:在应用运行时切换全屏模式

[英]Android: phonegap/cordova: switch full screen mode while app is running

I want to switch between full screen mode and normal mode while my app is running. 我想在我的应用程序运行时在全屏模式和普通模式之间切换。

is there any phonegap plugin to do this for me (Android) ? 是否有任何phonegap插件可以为我执行此操作(Android)?

if no, Please tell me how can I switch between full screen and normal in java, called in javascript. 如果没有,请告诉我如何在Java中(在javascript中调用)在全屏和普通之间切换。

Try the following method. 请尝试以下方法。 It displays full screen. 显示全屏。

Set Fullscreen as following method. 按以下方法设置全屏。

call this method before "super.LoadURL("....");" 在“ super.LoadURL(“ ....”);”之前调用此方法

    //Fullscreen (No title bar and status bar) 
    public void setFullscreen() {  
         getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);  //Clean FLAG  
         requestWindowFeature(Window.FEATURE_NO_TITLE);  
         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);  
    } 

Clean FLAG "FLAG_FORCE_NOT_FULLSCREEN". 清理FLAG "FLAG_FORCE_NOT_FULLSCREEN". This is supported by DroidGap. 这由DroidGap支持。

It's possible to do using this plugin: https://github.com/mesmotronic/cordova-plugin-fullscreen 可以使用此插件: https : //github.com/mesmotronic/cordova-plugin-fullscreen

it has functions AndroidFullScreen.showSystemUI, AndroidFullScreen.leanMode, AndroidFullScreen.immersiveMode to do the switch. 它具有功能AndroidFullScreen.showSystemUI,AndroidFullScreen.leanMode,AndroidFullScreen.immersiveMode进行切换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM