javascript 手机间隙没有状态栏?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4833995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 15:01:49  来源:igfitidea点击:

no status bar in phone gap?

javascripthtmlobjective-ccsscordova

提问by JqueryToAddNumbers

I have been trying to get the status bar to go away as i want to put a fullscreen game in. i'm using phonegap for the iphone

我一直在尝试让状态栏消失,因为我想放入全屏游戏。我正在为 iphone 使用 phonegap

thanks in advance.

提前致谢。

采纳答案by 010110110101

You can try:

你可以试试:

1) call this:

1)调用这个:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]

2) or this from your view controller.

2)或来自您的视图控制器。

[self setWantsFullScreenLayout:YES];

3) You can do it from the Interface Builder. Here's a video about it: http://www.youtube.com/watch?v=aPAChohC-4Q

3)您可以从界面生成器中完成。这是有关它的视频:http: //www.youtube.com/watch?v=aPAChohC-4Q

4) Someone else asked the same thing and got some related answers: Fullscreen UIView with Status bar and Navigation Bar overlay on the top

4)其他人问了同样的事情并得到了一些相关的答案: Fullscreen UIView with Status bar and Navigation Bar overlay on the top

回答by Drewid

For iPhone simply add

对于 iPhone,只需添加

<key>UIStatusBarHidden</key>
<true />

in your [appname]-info.plist file

在您的[appname]-info.plist 文件中

For completeness if you also wish to roll out for android this solution worked well

为了完整起见,如果您还希望为 android 推出此解决方案效果很好

In the file where you change activity to droidgap

在您将活动更改为 droidgap 的文件中

public class app extends DroidGap

Add the following import

添加以下导入

import android.view.WindowManager;

And then append the following within the class method

然后在类方法中附加以下内容

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

    super.loadUrl("file:///android_asset/www/index.html");
}

Hope this helps

希望这可以帮助

regards

问候

回答by spatical

If you want to the app to load with the status bar initially hidden:

如果您希望应用程序在最初隐藏状态栏的情况下加载:

  • [appname]-info.plist file
  • Find "Status bar is initially hidden"
    • Add new row if it isn't already there
  • Select 'YES' for the value
  • [appname]-info.plist 文件
  • 找到“状态栏最初是隐藏的”
    • 如果新行不存在,则添加新行
  • 为值选择“是”

"Status bar is initially hidden" is the key that is available at least in xcode 4.2 beta 5.

“状态栏最初是隐藏的”是至少在 xcode 4.2 beta 5 中可用的关键。

回答by Rocklan

For iOS7, you'll need to set the following setting in your [appname]-info.plist:

对于 iOS7,您需要在 [appname]-info.plist 中设置以下设置:

'View controller-based status bar appearance' to NO (Boolean)

“查看基于控制器的状态栏外观”为 NO(布尔值)