【问题标题】:Hide android 4.1v+ status bar in phonegap app在phonegap应用程序中隐藏android 4.1v+状态栏
【发布时间】:2016-02-01 19:31:57
【问题描述】:

如何在 phonegap 应用中隐藏 android 5.1 状态栏?
我尝试关注config.xml
<preference name="fullscreen" value="true" />

但发现它仅适用于 android 4.0 及更低版本 (https://developer.android.com/training/system-ui/status.html)

【问题讨论】:

  • 尝试使用cordova-plugin-statusbar

标签: android cordova


【解决方案1】:

您发布的链接中已经说明了该过程: 在 Android 4.1 及更高版本上隐藏状态栏:

View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();

注意: 一旦 UI 标志被清除(例如,通过离开活动),如果您想再次隐藏这些栏,您的应用需要重置它们。 据我了解,每次恢复应用程序时,您都需要执行此操作。所以建议在 OnResume() 方法中使用它。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2018-10-15
  • 2016-06-19
  • 2011-02-23
  • 2014-11-26
  • 2013-10-18
  • 2013-10-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多