My app has an option to go into fullscreen mode. Users of device Samsung Galaxy S7 Edge report to me that the navigation soft buttons are displayed in this case and do never vanish when the app is in fullscreen.
Here is the code I am using:
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
mainFrame.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
);
I have already played around with some of the options but it is hard because I do not own a Samsung device. Can someone with this device tell me the correct settings so navigation soft keys are not displayed in fullscreen mode?
i found something that might be helpfull. It's from Google's Developers site and I think it does exactly what you are looking for. I hope it will be some kind of help.
I think this part in the beginning is what you need but I also provide you a link below for more information:
Android 4.4 (API Level 19) introduces a new SYSTEM_UI_FLAG_IMMERSIVE flag for setSystemUiVisibility() that lets your app go truly "full screen." This flag, when combined with the SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_FULLSCREEN flags, hides the navigation and status bars and lets your app capture all touch events on the screen.
https://developer.android.com/training/system-ui/immersive.html
EDIT
i found an answer to a similar question with yours and the suggested approach is the following. try adding this to your code. it will do the trick.
int UI_OPTIONS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(UI_OPTIONS);
Here is the link to the original: https://stackoverflow.com/a/31483291/8434076
I have an application which will show fullscreen without problem on Android 4-6. But once test on Android 7.0, although the navigation and status bar are hide, the navigation bar position seems still occupied by a white bar. My application cannot automatically resize to occupy that space.
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
I use the above code to do the fullscreen. Please advise. Thanks.
In styles I've
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
and in the manifest file, in application I've specified my theme, but home button and back button are still visible, what should I do?
You must use Immersive feature of android. Immersive mode will be only working on devices with KitKat and higher. This, what is weird on your side, is fact, that basing on your words, you cannot even get these flags like this:
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
(or part of them). If it is this way, then it is looking, that your compileSdkVersion is lower, than it should be. On start I would advise you to update compileSdkVersion.
When you will do this, and you would like to use these flags please in places, where you want to use immersive mode add conditions, that will be looking like this:
if (Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
int UI_OPTIONS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
getWindow().getDecorView().setSystemUiVisibility(UI_OPTIONS);
}
Then it should not mess on older OS.
Use the following two way to achieve what you need
getActionBar().setDisplayHomeAsUpEnabled(false) to remove the home
button from the action bar.
ActionBar().setHomeAsUpIndicator(null);
getSupportActionBar().setHomeAsUpIndicator(null);
i prefer you use the first 1
Since the device I am developing has physical buttons, I do not want to see a navigation bar taking up my screen space. Rowboat-android on Beagleboneblack shows the navigation bar by default. Where do I turn it off?
EDIT: I am not developing applications. I am developing a Beaglebone based device. I want to remove the bar globally from the system. Somewhere there should be a code or setting in the Android source.
Found the answer at Building a wireless Android device using BeagleBone Black
Basically I edited device/ti/beagleboneblack/overlay/frameworks/base/core/res/res/values/config.xml file to set this entry:
<bool name="config_showNavigationBar">false</bool>
You should use IMMERSIVE flag like this:
private void hideSystemUI() {
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}
For more info, I recommend you to take a look at here.
I am building custom image.I going through android source, i want to get rid off bottom softkey button bar in android, Can some one please direct me to source file to change ?
To enable / disable them, as far as I know you simply have to edit the build.prop:
qemu.hw.mainkeys=0 (show on screen buttons)
or
qemu.hw.mainkeys=1 (disable on screen buttons)
If the line does not exist in your build.prop, add it at the bottom.
The easiest way to take a screen shot without the bottom navigation bar is to use an emulator (AVD) and edit its config file.
Go to .android/avd/virtual-device.avd
Then edit the config.ini:
hw.mainKeys=yes
hw.keyboard=yes
Both should be set to "yes"
In order to be able to see the bar again, set them back to "no".
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
use this code in onCreate. But this requires api lv over 19.
You cannot hide it permanently, however:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
this code hides the soft keys until the user interacts with your app. This is intentionally designed this way, just imagine, you don't provide any mean to exit from the current screen and hide theese keys, the user would be "trapped" in a one-way dead end.
You can find more here.
In addition to Aykut Burak SAFAK's answer above, you can put his code in onWindowFocusChanged event to make sure that whenever the Activity gets focus (e.g. after unlocking) it retains fullscreen without soft keys state.
#Override
public void onWindowFocusChanged(boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
With introduction of new SureLock for Samsung, Bottom Bar can be disabled or hidden without rooting of the device. All you have to do is to install SureLock Lockdown for Samsung and follow procedures mentioned in the following site,
http://www.42gears.com/blog/2013/07/disablehide-android-bottom-bar-without-rooting-samsung-galaxy-tablets/
Check out the following link.It may help you understanding it.
http://www.42gears.com/blog/2012/02/disable-bottom-bar-in-android-honeycomb-tablets-with-surelock/
for API 32 android studio emulator you can change "Gesture Navigation" to "3 Button Navigation" or "2 Button Navigation", because it's sometimes has problems with scrolling drawerLayout
Settings -> System -> Gestures -> System Navigation
If you only want to make the navigation bar (the button bar) less distracting, try youractivity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE)
Just change hw.mainKeys to yes in config.ini file.
1- Open config.ini file (To find file in your system follow steps below).
2- Don't forget to restart your emulator.
I think this is possible
To hide the softkey Try getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); but it is not working on tablet 4+.
Yes you can by using this in your activity :
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);}
}
Is there a way to stretch the controls to the bottom of the screen if I hide my navigation bar? I have an ImageView with the height set to match_parent but the absent navigation bar leaves a black rectangle.
For lvl 30
window.decorView.windowInsetsController?.hide(android.view.WindowInsets.Type.statusBars())
Below 30
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN