title: Same layout XMLs rendering differently on device
body: <p>I'm a bit new to Android, so please bear with me. I have two layout XML files which are practically the same. However, on my test device, they look totally different. They are files for List elements, and I know they should look the same because I copied the first one to make the second one. Here's the first one:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;ImageView
      android:layout_width="40dp"
      android:layout_height="40dp"
      android:layout_margin="16dp"
      android:id="@+id/arrival_icon"
      android:src="@drawable/red_circle"
      /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="40dp"
      android:id="@+id/arrival_dest"
      android:text = "Red Line"
      android:textSize="16sp"
      android:textColor="#000000"
      android:gravity="center_vertical"
      android:layout_marginTop="16dp"
      android:layout_marginLeft="16dp"
      /&gt;
  
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="40dp"
      android:id="@+id/arrival_time"
      android:text = "Red Line"
      android:textSize="16sp"
      android:textColor="#000000"
      android:gravity="right"
      android:layout_marginTop="16dp"
      android:layout_marginLeft="16dp"
      /&gt;
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="40dp"
      android:id="@+id/_id"
      android:text = "Red Line"
      android:textSize="16sp"
      android:textColor="#000000"
      android:gravity="center_vertical"
      android:layout_marginTop="16dp"
      android:layout_marginLeft="16dp"
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And here's the second one:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal" android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;View
      android:layout_width="40dp"
      android:layout_height="40dp"
      android:layout_margin="16dp"
      android:id="@+id/line_icon"
      android:background="@drawable/red_circle"
      /&gt;
  
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="40dp"
      android:id="@+id/line_name"
      android:text = "Red Line"
      android:textSize="16sp"
      android:textColor="#000000"
      android:gravity="center_vertical"
      android:layout_marginTop="16dp"
      android:layout_marginLeft="16dp"
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I'm not sure where else there could be an issue. If there's another XML or Java file that I need to post to determine the cause, please tell me, I'm lost. Can anyone please help?</p>
  
  <p>Thanks in advance :)</p>
  
  <p>Edit 1:</p>
  
  <p>Here are the screenshots for the first and second layouts, respectively:</p>
  
  <p><img src="https://i.stack.imgur.com/ntf4i.png" alt="First layout"></p>
  
  <p><img src="https://i.stack.imgur.com/eTErJ.png" alt="Second layout"></p>
  
  <p>Not much of a difference; the second layout had a strange margin on the left and right, as well as padding in the list element.</p>