I have an Android 5.1 tablet with root. I'm implementing an app in kiosk mode. For that I'm using the immersive mode, which nicely hides the navigation and status bar. But with a swipe these bars reappears, which is not what I want.
With adding qemu.hw.mainkeys=0 to the end of the build.prop file I was able to get rid of the navigation (bottom) bar. Unfortunately, the status bar still re-appears when i pull down from the upper side of the screen.
Is there a possibility to get rid of the status bar by editing the builds.prop file or in another way?
Not so familiar with root device, so i think about different way, have you try to hide it in main activity?
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();
This applied for 4.1 and Higher, see more in Android Developer
Related
Android
Hello.
I want to adjust the size of devices resolution and splash image in the splash screen.
I did try to apply png file to 9patch.
But I made gap between device to navigation bar.
And I'd try, try, try, I have reached this point.
I don't know how control navigation bar and button.
Please please please, teach me how hide navigation bar in the splash screen or how change the color in navigation bar's buttons.
Kindly review and give feedback.
It would be better to have some code so we can suggest what could be improved.
But here is some suggestions from android developer documentation.
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
read more here on how to hide navigation bar.
Link
The following is the official way of hiding the status bar:
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();
However, the status bar shows up on the first touch. Is it possible to prevent this. One can use getWindow().getDecorView().setOnSystemUiVisibilityChangeListener() to hide it again, but its brief display is a nuisance.
For API 19 and above, Immersive Full-Screen Mode is available for dealing with this.
My problem is simple and I have been unable to find a solution. The menu bar is very annoying in my app and I am hoping that there is a way to remove it.
Looking at Hiding the Navigation Bar I found this:
You can hide the navigation bar on Android 4.0 and higher using the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag. This snippet hides both the navigation bar and the status bar:
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
I do not know if that's exactly what you was looking for, but you can test it.
I suggest you read more about native modules, it enables you to write native code and access it from JS.
http://facebook.github.io/react-native/docs/native-modules-android.html#content
Also the StatusBar module is very similar to what you want to do here, you can have a look at the source.
https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java#L110
I want to hide Bottom Option Bar in Android. I don't know whether we call it Option Bar it or not.
Please check it out Image below : Tell me if we call it something else. It is in bottom.
Now, I want to hide it. How to do it ?
It's called navigation bar, the reason for it only having the options button is probably because your device has hardware buttons for home and back, that's why it looks like an options button only bar.
Refer to the docs for hiding it, although it will only work for versions supporting it.
For 4.0+
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
I have a fullscreen project, and am hiding the statusbar using
getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
in the main activity's onCreate.
This works, and hides the status bar just fine, until I add a YoutubeFragment and play a video. The moment the video loads, the status bar drops down, very annoying. I tried setting the flags all over the onInitializationSuccess listener, but no dice. The documentation doesn't mention the status bar on any non-full screen layout changes at all: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerFragment
Anyone any ideas?
Thanks in advance.
I don't know if you can put in manifest to hide action bar.
But try this function of Activity class
getActionBar().hide();
I was using a android 4.4.2 device to test with. With 4.1+ or higher there's another way to hide the status bar dynamically : http://developer.android.com/training/system-ui/status.html#41
//4.1+ Specific hiding of status bar
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
I do not have the problem with the status bar popping up when adding a YoutubeFragment. Why the old code didn't work with YoutubeFragments, or even setting the Theme to
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen"
, I have no idea though.