title: Android Device Changes Horizontal Margin by Itself at Runtime
body: <p>I have an XML that employs the following padding in its layout:</p>
  
  <pre><code>android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  </code></pre>
  
  <p>where both <code>@dimen/activity_vertical_margin</code> and <code>@dimen/activity_horizontal_margin</code> are <code>14dp</code> each.</p>
  
  <p>In my Java class, I use a toast to see, at runtime, what the actual margins are:</p>
  
  <pre><code>int vert = (int) getResources().getDimension(R.dimen.activity_vertical_margin);
  int horz = (int) getResources().getDimension(R.dimen.activity_horizontal_margin);
  Toast.makeText(getApplicationContext(), "vert: " + vert + "\n" + "horz: " + horz, Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>I'm testing this on 3 different devices:</p>
  
  <ol>
  <li>Samsung Galaxy S4 (Android version 4.2.2)</li>
  <li>Samsung Galaxy S3 (Android version 4.1.2)</li>
  <li>Motorola XOOM (Android version 4.1.2)</li>
  </ol>
  
  <p>For both the Samsung Galaxies, I get a return value for both <code>vert</code> and <code>horz</code> as 42. This is true whether the devices are vertical or horizontal. (Why they don't equal 14, I'm not sure, but as long as they're constant, I'm content.)</p>
  
  <p>However, for the XOOM, I get a return value for both <code>vert</code> and <code>horz</code> as 14 when the device is vertical. BUT, when I turn it to horizontal, <code>vert</code> stays at 14 and <code>horz</code> becomes 128 (nearly 10 times that of its vertical value).</p>
  
  <p>My question is, why is there this automatic change at runtime? There's nothing in the code that references it and makes it change (I know this because the other devices don't have this problem).</p>
  
  <p>Normally, I wouldn't care too much about this, but in this case, it does make my UI look pretty funky. I looked it up but it doesn't sound like anyone else is having the margins change on them at runtime.</p>