how do you remove the navigation bar on Android?

前端 未结 7 753
梦毁少年i
梦毁少年i 2021-02-11 02:52

When I listen to a YouTube video fullscreen in landscape on my Galaxy Nexus, the navigation bar on the right disapear after a few seconds (the bar which contains the "back&

相关标签:
7条回答
  • 2021-02-11 02:58

    The last information I have is that you can use the black tape to cover it. That's the suggestion given by Chet Haase. Watch this google IO 2011 session Q&A starting at 53minutes

    Youtube app also dim it, not remove it. It is called light out mode.

    View v = findViewById(R.id.view_id);
    v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
    
    0 讨论(0)
  • 2021-02-11 03:04

    I use this code to hide the navigation bar and it works perfectly for me

    View v = this.getWindow().getDecorView();
    
    v.setSystemUiVisibility(View.INVISIBLE);
    
    0 讨论(0)
  • 2021-02-11 03:04

    What you should do is set System Ui Visibility in onResume()

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    

    If you wont set it sticky bar will be visible again when touch screen will be occured

    0 讨论(0)
  • 2021-02-11 03:09

    SYSTEM_UI_FLAG_HIDE_NAVIGATION flag can be used on a View to hide the navigation bar until a user interaction occurs, starting from Android API 14.

    You should look at here and here.

    0 讨论(0)
  • 2021-02-11 03:15

    This code will hide the navigation bar until you swipe down from the status bar. It's the same method that Jetpack Joyride uses:

    View decorView = getWindow().getDecorView(); 
    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    

    You must also have this in the activity section of your XML file:

    android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
    
    0 讨论(0)
  • 2021-02-11 03:16
    ActionBar actionBar = getActionBar();
    actionBar.hide();
    

    That will do the trick. Also check out the HoneycombGallery example which demonstrates this working.

    0 讨论(0)
提交回复
热议问题