full screen app: stuck navigation bar - android

I wrote an app that is composed by a full screen webkit object. So, as soon as the activity starts, i set these flags:
SYSTEM_UI_FLAG_LAYOUT_STABLE
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
SYSTEM_UI_FLAG_HIDE_NAVIGATION
SYSTEM_UI_FLAG_FULLSCREEN
SYSTEM_UI_FLAG_IMMERSIVE
Problem is that when i swap down from the top border of the screen, status bar and navigation bar becomes visible (and this is ok, so you can close the app if you need it). Problem is that, after a few seconds, status bar goes away while navigation bar doesn't. It stucks there. Is there a flag I am missing? Or is there any hook I can use to detect when the status bar hides and then set back the flags?

Related

How to disable status bar and not hide it in android?

I want to permanently disable status bar, not hide it. I was able to disable navigation bar by giving qemu.hw.mainkeys=1 in system.prop and building the image.
But, i didn't find any method to disable status bar.  I even tried with the below flags -
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
View.SYSTEM_UI_FLAG_FULLSCREEN;
But, these temporarily hide the status and navigation bar. If the user taps the screen, they pop back up. With these flags, they do not get fully disabled. There are many solutions online on how to hide the status and navigation bar, but not fully disable them.
1) The only method i found to disable status and navigation bar is by disabling systemui.
pm disable com.android.systemui
But i noticed that, disabling systemui, disables a lot of things , like SD card, volume, wallpapers,etc.
2) The other method that i tried is changing status_bar_height in frameworks/base/core/res/res/values/dimens.xml to 0dp as shown below -
<!-- Height of the status bar -->
<dimen name="status_bar_height">#dimen/status_bar_height_portrait</dimen>
<!-- Height of the status bar in portrait -->
<dimen name="status_bar_height_portrait">0dp</dimen>
<!-- Height of the status bar in landscape -->
<dimen name="status_bar_height_landscape">#dimen/status_bar_height_portrait</dimen>
But, this caused the boot animation to not load and in-turn not to display the screen contents (My lvds went just dark).
How do i disable status bar? 
The only way I was able to hide the status bar is by using this command
settings set secure user_setup_complete 0
You can enable it again by setting it to 1 or get the current status by using
settings get secure user_setup_complete
Another idea might be to use what you're using now to hide it but edit the swipe event function in source code for the status bar java class to do nothing so the swipe down gets ignored.

Disable navigation and status bar in Android application

I want to permanently disable navigation and status bar for my android application i have used immersive mode for that but when i touch anywhere on screen the navigation and status bar reappears and on touching again on screen it goes back.I just want that all the navigation bar and status bar should not come when my application is running at any of the scenario please help.
That is not possible without root. With root permission you can achieve this but still its not a preferred.

Android hide action bar, status bar and navigation controls

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.

Dismiss or remove System Navigation Bar

I want to dismiss bottom Navigation bar for one particular screen.
I tried using
setSystemUiVisibility(HorizontalScrollView.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I have put this in Onscroll of my scrollView, ontouch of my views.
but the issue is its comes back and the screen gets resize.
Any suggestions by which I can completely remove the NAVIGATION BAR.
Check out SYSTEM_UI_FLAG_HIDE_NAVIGATION, this flag hides the navigation bar until the user interacts with the device. It's new in Android 4.0. You can enable this flag for example like this:
getWindow().getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Note that the navigation won't disappear again automatically, you have to set it every time after the user interacted with the device.
Alternatively you can make the navigation less obtrusive by using SYSTEM_UI_FLAG_LOW_PROFILE, this changes the buttons into small dots (e.g. like the camera app).

How to hide StatusBar in Android 4

How to hide StatusBar in Android 4:
Help me, please.
The bar that is shown in the image in your question is called the system bar.
On devices with no hardware buttons the system bar will always be displayed if user input occurs. You can call setSystemUiVisibility with the flags SYSTEM_UI_FLAG_HIDE_NAVIGATION and request the following window feature FLAG_FULLSCREEN via the Window. This should hide the system bar and make your view fullscreen as long as the user does not interact with the screen. If the user touches the screen the system bar will reappear to allow the user to use the home and back software keys.
If you have a view that the user will interact with but you want him not to be distracted by the system bar you can set the SYSTEM_UI_FLAG_LOW_PROFILE flag. This should dim the system bar and make it less distracting.
I agree with Janusz. You can not get 100% true full screen in Android 4.0.
Use the following to dim the notification bar (aka. status bar, system bar)
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_LOW_PROFILE);
And use this to hide it
getWindow().getDecorView().setSystemUiVisibility
(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
And, if I guess right, you are trying to achieve a "kiosk mode". You can get a little help with an app named "surelock". This blocks all the "home" and "back" actions.
If you wish a smooth experience without an intermediate "jerked" layout, here is the solution from API level 14.
final Window window = getWindow();
if (isFullScreen == true)
{
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// This flag will prevent the status bar disappearing animation from jerking the content view
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
else
{
window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
you can hide it. just use following api in OnCreate() method
requestWindowFeature(Window.FEATURE_NO_TITLE);

Categories

Resources