Overlapping shadow effect remains on Navigation Drawer's NavigationView

后端 未结 4 1876
孤独总比滥情好
孤独总比滥情好 2021-01-01 18:50

I have refined the Navigation Drawer Activity project template of Android Studio, which uses Toolbar, v7.app.ActionBarDrawerToggle and

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 19:09

    Thanks to hata i have succeed to completely hide system UI, by merging his original code:

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    
      if (hasFocus) {
        View decorationView = getWindow().getDecorView();
        decorationView.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 the solution code added in onCreate of my Activity before calling inflate:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
        | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    

    Apparently, the flag WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS was the missing piece to make the full screen work as expected on my device (API 21)

提交回复
热议问题