title: Android hide action bar, status bar and navigation controls
body: <p>I am trying to make an activity that is completely fullscreen in landscape, and have the status bar and navigation buttons visible in portrait. 
  I have to be able to do this programatically.</p>
  
  <p>This is how I tried make the app go fullscreen.</p>
  
  <pre><code>private void hideNavigationAndStatusBars(){
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); // these work only on API 21 and above
  
      View decorView = getWindow().getDecorView();
      int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
      decorView.setSystemUiVisibility(uiOptions);
  }
  </code></pre>
  
  <p>The problems are the following :</p>
  
  <ol>
  <li>On some devices, I get a blank portion on the top of the screen, that is equal to the height of the status bar, even though the status bar is not showing</li>
  <li>On other devices, the activity fills the whole screen, but when I click anything, the status bar and navigation bar appear, they resize the layout and it looks very ugly</li>
  </ol>
  
  <p>What I am trying to achieve:</p>
  
  <ol>
  <li><p>The activity should fill the whole screen in landscape, positioned behind the status bar and navigation bar, if they appear</p></li>
  <li><p>When the user clicks on the screen, he/she should interact with the screen. Instead the first click displays the status and navigation bars and the interaction is possible only after this</p></li>
  <li><p>The status bar should only appear when the user drags from the top</p></li>
  </ol>