title: ImageView floating in center of CardView
body: <p>I want a simple card based layout with the image at the top of the card. However whenever I add this, the image floats in the vertical center of the card. How can I force the image to the top of the card without any hacks such as setting negative margins?</p>
  
  <p>The XML I am using is here</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;RelativeLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="#EEE"&gt;
  
      &lt;android.support.v7.widget.CardView
          xmlns:card_view="http://schemas.android.com/apk/res-auto"
          android:id="@+id/card_view"
  
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="#000000"
          android:layout_alignParentTop="true"
          android:layout_alignParentStart="true"
          &gt;
  
          &lt;ImageView android:src="@drawable/edinburgh"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentTop="@id/card_view" &gt;&lt;/ImageView&gt;
  
      &lt;/android.support.v7.widget.CardView&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>And here's a screenshot of the output:</p>
  
  <p><a href="https://i.stack.imgur.com/YpNYo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YpNYo.jpg" alt="enter image description here"></a></p>