Google's official documents are:
Https://developer.android.com/training/system-ui/navigation.html#behind
Sample code
1 View decorview = GetWindow (). Getdecorview (); 2//Hide both the navigation bar and the status Bar.3//system_ui_flag_ful Lscreen is only available on Android 4.1 and higher, but AS4//a general rule, you should design your app to hide the STA Tus bar whenever you5//hide the navigation bar.6 int uioptions = view.system_ui_flag_hide_navigation7 | View.system_ui_flag_fullscreen;8 decorview.setsystemuivisibility (uioptions);
Original:
However, there is a problem.
This can really hide the bottom virtual navigation bar, but once you tap the screen, the navigation bar will appear (for about 1 seconds) and consume your click events. If you want to click a button (the navigation bar is hidden), you need to point two times in a row. Because the navigation bar disappears after 1 seconds, clicking on the screen event will block the consumption again.
The Final Solution
/** * Hide virtual keys and full screen * /protected void Hidebottomuimenu () { //Hide virtual keys, and fullscreen if (Build.VERSION.SDK_ INT > One && Build.VERSION.SDK_INT < +) {//Lower API View v = This.getwindow (). Getdecorview (); V.setsystemuivisibility (View.gone); } else if (Build.VERSION.SDK_INT >=) { //for new API versions. View Decorview = GetWindow (). Getdecorview (); int uioptions = View.system_ui_flag_hide_navigation | View.system_ui_flag_immersive_sticky | View.system_ui_flag_fullscreen; Decorview.setsystemuivisibility (uioptions); } }
Android hides the bottom virtual keys