title: Trying to space items in a ListView while using adapter and drawable. Margin is not working
body: <p>I am trying to have a listview where items have rounded corners and the items are spaced out from each other. This is done using a custom ArrayAdapter. </p>
  
  <pre><code>MyCustomAdapter arrAdapter = new MyCustomAdapter();
  setListAdapter(arrAdapter);
  </code></pre>
  
  <p>I am using a drawable image to round the corners</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" &gt;
  
    &lt;corners android:radius="10dp" /&gt;
  
    &lt;gradient
      android:angle="90"
      android:endColor="#993333"
      android:startColor="#ffffff"
      android:type="sweep" /&gt;
  
    &lt;solid android:color="#ffffff" /&gt;
  
    &lt;stroke
      android:width="1dp"
      android:color="#000000"  /&gt;
  &lt;/shape&gt;
  </code></pre>
  
  <p>and setting it in the layout as background to the top most container - the LinearLayout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_margin="4dp"
  android:background="@drawable/square"
  android:orientation="horizontal" &gt;
  
  &lt;TextView
      android:id="@+id/routeTag"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_margin="5dp"
      android:background="@drawable/circle"
      android:padding="10dp"
      android:text="text"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" &gt;
  
          &lt;TextView
              android:id="@+id/stop"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:padding="5dp"
              android:text="some text"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textSize="14sp" /&gt;
  
          &lt;TextView
              android:id="@+id/stopD"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"
              android:padding="5dp"
              android:text="(text)"
              android:textColor="#777777"
              android:textSize="10sp" /&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" &gt;
  
          &lt;TextView
              android:id="@+id/nextTT"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:paddingBottom="5dp"
              android:paddingLeft="5dp"
              android:paddingRight="9dp"
              android:paddingTop="5dp"
              android:text="text"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textSize="14sp" /&gt;
  
          &lt;TextView
              android:id="@+id/moreTT"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_toRightOf="@id/nextTrainTime"
              android:paddingBottom="5dp"
              android:text="text"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textSize="12sp" /&gt;
      &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>For some reason in the graphical display I am able to see that single element exactly as I want it - with margins all around (I also want it to move away from the edges of the screen left and right). 
  But when I run this and let the adapter do its job I am getting a list of items, touching the sides of the screen and no space between them apart forma single line which is used to separate the items on a normal list. </p>
  
  <p>Anyone have a clue how to make it behave?! I have search far and wide. </p>
  
  <p>Thanks for your help</p>