2

the instructions on Android Developers을 따라 내비게이션 창에 내 액티비티 전체 화면을 적용했습니다.작업 표시 줄 및 상태 표시 줄을 숨기지 않는 몰입 형 전체 화면

문제는 액션 바가 숨어 있지 않다는 것입니다. 상태 표시 줄의 경우 상태의 배경색이 그대로 남아있는 동안 텍스트가 사라집니다.

// This snippet hides the system bars. 
    private void hideSystemUI() { 
     // Set the IMMERSIVE flag. 
     // Set the content to appear under the system bars so that the content 
     // doesn't resize when the system bars hide and show. 
     View mDecorView = getWindow().getDecorView(); 
     mDecorView.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 // hide nav bar 
         | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar 
         | View.SYSTEM_UI_FLAG_IMMERSIVE); 

     mIsActionBarVisible = false; 
    } 

    // This snippet shows the system bars. It does this by removing all the flags 
// except for the ones that make the content appear under the system bars. 
    private void showSystemUI() { 
     View mDecorView = getWindow().getDecorView(); 
     mDecorView.setSystemUiVisibility(
       View.SYSTEM_UI_FLAG_LAYOUT_STABLE 
         | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 
         | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 

     mIsActionBarVisible = true; 
    } 

    @Override 
    public void onWindowFocusChanged(boolean hasFocus) { 
     super.onWindowFocusChanged(hasFocus); 
     if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { 
      if (hasFocus) { 
       getWindow().getDecorView().setSystemUiVisibility(
         View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 
         | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 
         | View.SYSTEM_UI_FLAG_FULLSCREEN 
         | View.SYSTEM_UI_FLAG_IMMERSIVE); 
      } 
     } 
    } 

이 잘못 됐을 수도 무엇 younhave 어떤 생각을하시기 바랍니다 Before fullscreen

코드 enter image description here 이전과 이후

?

getSupportActionBar().hide(); 
:

답변

0

내가 명시 적으로 액션 바 숨기기하여이를 해결
관련 문제