I am able to hide notification bar using this code
setWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
But I want the user to have an option to show and hide notification bar.
Currently my Activity permanently hides the notification bar.
How cam I do it?
You can exit full screen mode (i.e. show status bar) by using:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
Related
I am trying to make an activity that is completely fullscreen in landscape, and have the status bar and navigation buttons visible in portrait.
I have to be able to do this programatically.
This is how I tried make the app go fullscreen.
private void hideNavigationAndStatusBars(){
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); // these work only on API 21 and above
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
The problems are the following :
On some devices, I get a blank portion on the top of the screen, that is equal to the height of the status bar, even though the status bar is not showing
On other devices, the activity fills the whole screen, but when I click anything, the status bar and navigation bar appear, they resize the layout and it looks very ugly
What I am trying to achieve:
The activity should fill the whole screen in landscape, positioned behind the status bar and navigation bar, if they appear
When the user clicks on the screen, he/she should interact with the screen. Instead the first click displays the status and navigation bars and the interaction is possible only after this
The status bar should only appear when the user drags from the top
to hide action bar call getActionBar().hide() method.
And to make activity full screen call
this method
requestFeature(Window.FeatureNo_Title)
Use immersive mode and system ui stable flag to achieve this. For more information please refer the document in developer site.
I am searching for hours, but nothing found.
I just want to hide/show status and navigation bar when I hit the screen, like android gallery.
// Hide status bar
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Show status bar
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
The code above works fine for Status bar, but what about navigation bar (bottom bar) like android gallery? (I dont want to use 4.4 immersive mode)
I am working around one android app while i need to show and hide the status bar when button clicked.is it possible?please help to solve this issue.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Show status bar
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
I want to show an icon in the status bar while my app is running but I don't want a notification to appear when the notification drawer is expanded, how can I do that?
So you want to display something on the user device, that the user can't control or remove in any way nor know where it came from? Not possible...
How can i do a notification in the status bar without the expanded message in the "Notifications" window? (only want the icon)
I am working on titanium project and am facing a problem where when I use win.open({modal:true}); my application screen does not hide the status bar and title bar in Android devices. How can I fix this?
to hid ethe title bars in your screen just do this in your oncreate before adding the setcontentview.This will hide your title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);