title: Why is 1px sometimes 2px when specified in Android XML?
body: <p>I've got a desire for a one-pixel divider line, just for looks.  I thought I could accomplish this using a View of height 1px, with a defined background.  However, I'm getting some very odd behavior on different devices - sometimes the 1px ends up as 2px.</p>
  
  <p>Take this sample layout for example:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
      &lt;View android:layout_width="fill_parent" android:layout_height="1px"
          android:background="@android:color/white" android:layout_marginBottom="4dp" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>When run on my G1, <a href="https://i.imgur.com/4aqjq.png" rel="nofollow noreferrer">this comes out fine</a>.  But on the Nexus One, <a href="https://i.imgur.com/R6GE2.png" rel="nofollow noreferrer">it alternates between 1px lines and 2px lines</a>.</p>
  
  <p>Does anyone know where this is going awry?  Why does Android sometimes make 1px into 2px?</p>
  
  <p>Edit: To make this absolutely clear, I do not care about solving my example in particular; what I care about is being able to say "this View shall be 1px high", in any circumstance, not just this example.</p>