Explanation: I would like to completely hide the Navigation Bar and Status Bar for my application. Actually, the idea behind hide is user doesn't go to the system setting and uses the system feature during application is running.
What i have tried?
I have tried to implement the System UI feature to make my screen fullScreen and Immersive mode as per the official android guideline. Please visit these links:
https://developer.android.com/training/system-ui/navigation.html
https://developer.android.com/training/system-ui/immersive.html
Here, is my code.
uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE; // hide status bar
decorView.setSystemUiVisibility(uiOptions);
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
Log.e(TAG,"INSIDE onSystemUiVisibilityChange()=>"+visibility);
if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN)==0){
decorView.setSystemUiVisibility(uiOptions);
}else{
decorView.setSystemUiVisibility(uiOptions);
}
}
});
But the problem of the above implementation is when i touch on the screen it will again visible. This is the main problem. I want to completely hide or lock Navigation Bar and Status Bar.
If you have any content can we achieve this feature or not? Please provide me. Could you please suggest me for this feature?