title: How can I align an element to the right in the FrameLayout?
body: <p>I have a FrameLayout which contains 2 views , the second is something like a <code>Close Button (X)</code> and i want to position it on the right.</p>
  
  <p>I've tried layout_gravity = " right ", but that didn't work.</p>
  
  <p>This is my layout xml :</p>
  
  <pre><code>&lt;FrameLayout android:layout_width="320dp"
      android:layout_height="wrap_content"
      android:id="@+id/layoutSmallImg"&gt;
  
      &lt;ImageView android:id="@+id/bigImage"
          android:layout_width="320dp" android:layout_height="wrap_content"/&gt;
  
      &lt;ImageView android:id="@+id/bigImage"
          android:layout_width="320dp" android:layout_height="wrap_content"/&gt;
  
      &lt;ImageButton android:id="@+id/closebutton"
          android:background="@android:color/transparent"
          android:layout_height="30dp" android:layout_marginTop="10dp"
          android:layout_alignParentRight="true"
          android:layout_width="30dp" android:paddingLeft="40dp"
          android:visibility="gone" 
          android:src="@drawable/close" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>