title: Android Webview - javascript screen dimensions vs actual screen dimensions
body: <p>I have a very simple Activity with the following layout...</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
      &lt;WebView
          android:id="@+id/webview"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" &gt;
      &lt;/WebView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The <code>Activity</code> itself is set for full screen (no title bar and no Android notification bar) and forced to landscape.</p>
  
  <p>So...on my HTC Desire, the <code>WebView</code> in theory is occupying 800x480 (wxh) pixels. All good so far, it DOES fill the screen totally.</p>
  
  <p>The confusion I have is that the <code>WebView</code> loads an HTML document from a server which uses a javascript function to get the screen width and height...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  &lt;!--
      function getDims() {
          var screenW = screen.width;
          var screenH = screen.height;
          return "size=" + screenW + "x" + screenH;
      };
  --&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>...the problem is that <code>screenW</code> is 527 and <code>screenH</code> is 320 and I don't understand why.</p>
  
  <p>Looking at a height of 320, it's exactly two-thirds of 480 so I then looked at what two-thirds of 800 is (~533). So it seems both <code>screen.width</code> and <code>screen.height</code> in the javascript are reporting two-thirds of actual pixels available.</p>
  
  <p>Can anyone explain why this is happening?</p>