title: Spreading gracefully buttons horizontally across a Layout
body: <p>This is my very first post at Stackoverflow. Before I make my question, I just want to say that this is a great resource of information and I find the community extremely helpful.
  I hope to be able to share my Android development knowledge with everyone else as well.</p>
  
  <p>I have been developing for Android for 6 months now and, although I have learned very much, I still greatly struggle when it comes to layout/design.</p>
  
  <p>I have one layout.xml file that contains a Relative layout. Inside this layout, I have three buttons. I want those three buttons to have a certain width size that would grow or shrink depending on the device's screen size/density.</p>
  
  <p>This is the xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/relativeLayout1123123213"
      android:layout_width="fill_parent"
      android:layout_height="@dimen/actionbar_height"
      android:orientation="horizontal"&gt;
  
      &lt;Button
          android:id="@+id/btnLogin"
          android:layout_width="100dp"
          android:layout_height="50dp"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center"
          android:text="Earned" /&gt;
  
      &lt;Button
          android:id="@+id/btnLogin2"
          android:layout_width="113dp"
          android:layout_height="50dp"
          android:layout_alignParentTop="true"
          android:layout_toRightOf="@+id/btnLogin"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center"
          android:text="In Progress" /&gt;
  
  
       &lt;Button
          android:id="@+id/btnLogin3"
          android:layout_width="107dp"
          android:layout_height="50dp"
          android:layout_alignParentTop="true"
          android:layout_toRightOf="@+id/btnLogin2"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center"
          android:text="Done" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I hard coded the width values, considering that I have different text sizes in each button... so that should obviously affect the width as well...</p>
  
  <p>My question is... is there any intelligent way to accomplish this? Maybe programatically, when I know the current device's screen size?</p>
  
  <p>Thanks everyone!
  Felipe</p>
  
  <p>====================================================
  UPDATED SECTION</p>
  
  <p>Hey guys,
  Thanks for your help so far.</p>
  
  <p>I have added the LinearLayout and the weight as per recommendation, but I am still not exactly getting what I want. It's almost there, but not quite.</p>
  
  <p>My new xml:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="@dimen/actionbar_height"
  android:orientation="horizontal"  
  android:gravity="center" android:weightSum="1"&gt;
  
      &lt;Button
          android:id="@+id/btnLogin"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center"
          android:text="@string/bottonbar_earned" 
          android:layout_weight=".10"/&gt;
  
      &lt;Button
          android:id="@+id/btnLogin2"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight=".10"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center"
          android:text="@string/bottonbar_inprogress" /&gt;
  
  
       &lt;Button
          android:id="@+id/btnLogin3"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:background="@drawable/button"
          android:drawableLeft="@drawable/balloon_overlay_close"
          android:gravity="center" android:text="@string/bottonbar_redeemed"
          android:layout_weight=".90"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This is the result <a href="http://desmond.imageshack.us/Himg822/scaled.php?server=822&amp;filename=47659084.png&amp;res=medium" rel="nofollow">link</a>
  Can you see the end of the right side? I don't think the weight is distributed like it should, although I set a .90 weight to the third button.
  What do you guys think?</p>