title: Android; How to Right Justify Buttons while other widgets stay Left Justified
body: <p>I'm new to Android and my app is finally working however I am having trouble with the layout.</p>
  
  <p>The <code>xml</code> below is stripped down but where I marked it <code>&lt;repeats&gt;</code> I have 4 horizontal layouts.</p>
  
  <p>Each with different widgets <code>Spinner</code>, <code>SeekBar</code> and <code>RadioButtons</code> all seperated by a divider.</p>
  
  <p>Each you pick a setting and press the <code>Set</code> button to the right.</p>
  
  <p>My issue, though all widget are neatly Left justified the vertical alignment of the buttons is all over the place.</p>
  
  <p>If i just play with widget margins it will not fit right with different Android devices.</p>
  
  <p>How can I get the <code>Buttons</code> vertically lined up to the right without moving all else from the left?</p>
  
  <pre><code>           GETTING                              WANT
   -------------------------------   -------------------------------- 
   | &lt;Spinner&gt;  &lt;button&gt;          |  | &lt;Spinner&gt;           &lt;button&gt; |      
   | &lt; -------- Divider --------&gt; |  | &lt; -------- Divider --------&gt; |
   | &lt;RadioButton &gt;  &lt;button&gt;     |  | &lt;RadioButton&gt;       &lt;button&gt; |
   | &lt; -------- Divider --------&gt; |  | &lt; -------- Divider --------&gt; |
   | &lt;SeekBar&gt;  &lt;button&gt;          |  | &lt;SeekBar&gt;           &lt;button&gt; |
   | &lt; -------- Divider --------&gt; |  | &lt; -------- Divider --------&gt; |
   | &lt;RadioButton&gt;       &lt;button&gt; |  | &lt;RadioButton&gt;       &lt;button&gt; |
   -------------------------------   --------------------------------
  </code></pre>
  
  <p>Here is my related code:</p>
  
  <pre><code>content_main.xml 
   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      tools:context=".MainActivity"
      tools:showIn="@layout/activity_main"&gt;
  
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center_vertical"
          tools:scrollY="?android:attr/scrollbarSize"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_alignParentEnd="true"
              android:layout_alignParentTop="true"
              android:orientation="vertical"&gt;
  
  &lt;repeats&gt;   &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"&gt;
                  &lt;Spinner
                      android:id="@+id/dynamic_TZ_spinner"
                      android:layout_width="223dp"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="@dimen/dp20"
                      android:layout_marginRight="@dimen/dp20" /&gt;
                  &lt;Button
                      android:id="@+id/TZ_btnSubmit"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="@string/set" /&gt;
              &lt;/LinearLayout&gt;
              &lt;View
                  android:id="@+id/divider3"
                  android:layout_width="match_parent"
                  android:layout_height="5dp"
                  android:layout_marginTop="@dimen/dp10"
                  android:background="?android:attr/listDivider"
                  android:visibility="visible" /&gt;
  ....            
  
              &lt;/LinearLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>