Reputation: 3211
I thought that is a solution for that but I cannot find it. I know that I can disable back button by overriding onBackPress()
method and not call super.onBackPress()
but it only disable, I want to remove/hide from navigation bar this button.
And I known that on some device where the back button is a part of hardware it can be done.
To be clear I mean arrow on below screen:
Upvotes: 0
Views: 1335
Reputation: 4782
use this code in your onCreate() method : to hide
View bView = getWindow().getDecorView();
bView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Upvotes: 0
Reputation: 3922
You can find solution in the 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);
and this code should be placed in onCreate()
method in the Activity
after initializing all UI elements.
Upvotes: 1