简体   繁体   中英

Nativescript - Hide Status Bar in Android

I'm using Nativescript 7 and I'm trying to hide the status bar on android (The one with the clock, battery, etc... not the action bar).

So far I've found answers that seem to make it translucent. I'm not interested in making it translucent as I'd like for it to disappear completely when the app loads.

At the moment I've used things like:

page.backgroundSpanUnderStatusBar = true;

But it simply makes the page content flow underneath the status bar (obviously).

Are there any ways to do this without a plugin? If so, any code samples would be appreciated.

Why you don't want to use a plugin? You can try native-status-bar

import * as statusBar from 'nativescript-status-bar'

statusBar.hide();

You can search for something similar, eg nativescript-plugin-statusbar

this.statusbar.hideStaturbar()

If you need a solution without a plugin you can try to use fullscreen flag:

const application = require('application').android
const activity = application.startActivity
const win = activity.getWindow()
win.addFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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