title: How to create cross button in RelativeLayout
body: <p>I am going to create a cross delete button for an icon in RelativeLayout.</p>
  
  <p>It should look like this:</p>
  
  <p><img src="https://i.stack.imgur.com/FSAoI.jpg" alt="icon"></p>
  
  <p>Unfortunately I can't place the delete button outside the icon.</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
      &lt;ImageView
          android:id="@+id/icon"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@mipmap/icon"/&gt;
  
      &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignRight="@id/icon"
          android:src="@mipmap/delete_button"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>If I add some margin to the delete button, the button will be smaller but it is still inside the icon.</p>
  
  <pre><code>&lt;ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignRight="@id/icon"
      android:layout_marginLeft="45dp"
      android:src="@mipmap/delete_button"/&gt;
  </code></pre>
  
  <hr>
  
  <p>After I add margin to icon imageview, the position still incorrect, if I delete the <code>layout_alignRight</code> of delete button, it is right position on the left.</p>
  
  <p><img src="https://i.stack.imgur.com/ipZy3.png" alt="margin icon"></p>