title: Android getDisplayMetrics() not returning accurate display size
body: <p>I'm trying to get the pixel width/height of the device for placing elements and mapping touch events on the screen but not getting the desired effect (notice lower right square should be completely flush with the bottom right):</p>
  
  <p><a href="https://i.stack.imgur.com/12cWz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/12cWz.png" alt="White square should be flush in the lower right corner"></a></p>
  
  <pre><code>// screen size
      DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
      float ScrDensity = metrics.density;
      int metricHeight = metrics.heightPixels;//
      int metricWidth = metrics.widthPixels;//
  
      Log.i("AllMetrics", metrics.toString());
  
      // temp
      int rightButton_diameter = 100;
      int rightButton_xpos = metricWidth - rightButton_diameter;
      int rightButton_ypos = metricHeight - rightButton_diameter;
  </code></pre>
  
  <p>Where AllMetrics returns:</p>
  
  <pre><code>DisplayMetrics{density=2.0, width=720, height=1184, scaledDensity=2.0, xdpi=320.0, ydpi=320.0}
  </code></pre>
  
  <p>I notice that the returned height is also different from the 720x1280 listed in the Virtual Device Manager (API 19, Android 4.4) and the x/y positions of the touch events seems accurate to the drawn elements (ie the clickable area of the button is the same as where it is being drawn)</p>
  
  <p><strong>Is this a configuration error or am I using the incorrect method of fetching screen position?</strong></p>