2

私はthe instructions on Android Developersに続いて、ナレーショントレイで自分のアクティビティに没入型フルスクリーンを適用しました。アクションバーとステータスバーを非表示にする没入型フルスクリーン

問題は、アクションバーが隠れていないことです。ステータスバーの場合、ステータスの背景色がそのまま残りますが、テキストは消えてしまいます。 enter image description here コード

// 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); 
      } 
     } 
    } 

AFTER Before fullscreen

、BEFORE

は間違っているかもしれないものyounhave任意のアイデアをしてください?

答えて

0

私は明示的にアクションバーを非表示にすることで、これを解決:

getSupportActionBar().hide(); 
関連する問題