title: Android DisplayMetrics display absolute size varies with orientation
body: <p>Has anyone noticed this issue and resolved the way of getting the absolute display size consistently in both orientations?</p>
  
  <p>Example, Nexus 5 (5.0.1):</p>
  
  <ul>
  <li>Portrait: width = 1080 height = 1776</li>
  <li>Landscape: width = 1794 height = 1080</li>
  </ul>
  
  <p>I would have thought that the height in portrait would match the width in landscape. Initially suspected the status bar, but <a href="http://developer.android.com/reference/android/util/DisplayMetrics.html#heightPixels" rel="nofollow">docs</a> are clear. Anyway the status bar height in this example is 75px in either orientation and the diff in the example is 18px.</p>
  
  <p>Code snippet for display width and height in pixels:</p>
  
  <pre><code>DisplayMetrics displaymetrics = new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
  int height = displaymetrics.heightPixels;
  int width = displaymetrics.widthPixels;
  
  String dimensions = String.format("width = %d height = %d", width, height);
  Log.v(TAG, dimensions);
  </code></pre>