title: Android align button depending on visibility
body: <p>I have a little issue with setting align of a button in my application. I have 4 different buttons in one layout and depending on some values from database I have to set the visibility of one button. Here is the example of xml code which I'm using :</p>
  
  <pre><code> &lt;RelativeLayout 
      android:id="@+id/coll_buttons"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:layout_gravity="center"
      android:layout_marginBottom="10dp"&gt;
  
  
    &lt;Button
          android:id="@+id/sync"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Synchronize"
          android:textSize="9dp"
          android:background="@drawable/ic_white_button"
          android:textColor="#333333"
          android:layout_margin="10dp"
          android:paddingTop="10dp"
          android:paddingBottom="10dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:layout_alignParentLeft="true" /&gt;   
  
      &lt;Button
          android:id="@+id/activate"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Activate"
          android:textSize="9dp"
          android:background="@drawable/ic_white_button"
          android:textColor="#333333"
          android:layout_margin="10dp"
          android:paddingTop="10dp"
          android:paddingBottom="10dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:layout_alignParentLeft="true" /&gt;
  
      &lt;Button 
          android:id="@+id/buy_stampii"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Buy Stampii"
          android:textSize="9dp"
          android:background="@drawable/ic_white_button"
          android:textColor="#333333"
          android:layout_marginTop="10dp"
          android:paddingTop="10dp"
          android:paddingBottom="10dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:layout_toRightOf="@+id/activate"
          android:layout_marginLeft="5dp" /&gt;
  
      &lt;Button
          android:id="@+id/deactivate"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Deactivate"
          android:textSize="9dp"
          android:background="@drawable/ic_white_button"
          android:textColor="#333333"
          android:layout_marginTop="10dp"
          android:layout_marginRight="10dp"
          android:paddingTop="10dp"
          android:paddingBottom="10dp"
          android:paddingLeft="15dp"
          android:paddingRight="15dp"
          android:layout_alignParentRight="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>In the first case I have to set the visibility of <code>Button Activate</code> to false and set the visibility of <code>Button Sync</code> to true. But when I do that my <code>Buy Stampii</code> button is overlaying <code>Sync Button</code> because I'm setting <code>Buy Stampii</code> button <code>toRightOf</code> <code>Activate Button</code>. So is there any way that I can set to <code>Buy Stampii</code> Button <code>toRightOf</code> property for two different buttons or how can I solve that issue?</p>
  
  <p>Thanks a lot!    </p>