title: How to have flexible buttons allign in android?
body: <p>Hi question maybe difficult to understand but I will try my best.
       First of all this is the code</p>
  
  <pre><code>    &lt;Linear
  android:id="@+id/interestLayout"
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  android:layout_below="@+id/layout_roots"
  
  android:background="#e0e0e0"&gt;
  
  &lt;Button
      android:id="@+id/dancing"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:background="@drawable/ruhesi_buttondesigns"
      android:onClick="toggling"
      android:text="@string/dancing"
      android:textColor="#FF4444" /&gt;
  
  &lt;Button
      android:id="@+id/cooking"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:layout_alignTop="@+id/dancing"
      android:layout_marginLeft="10dp"
      android:layout_toEndOf="@+id/dancing"
      android:layout_toRightOf="@+id/dancing"
      android:background="@drawable/ruhesi_buttondesigns"
      android:onClick="toggling"
      android:text="@string/cooking"
      android:textColor="#FF4444" /&gt;
  
  &lt;Button
      android:id="@+id/painting"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:layout_marginLeft="10dp"
      android:layout_toRightOf="@+id/cooking"
      android:layout_toEndOf="@+id/cooking"
      android:background="@drawable/ruhesi_buttondesigns"
      android:onClick="toggling"
      android:text="@string/painting"
  
      android:textColor="#FF4444" /&gt;
  
  &lt;Button
      android:id="@+id/playing_instruments"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:layout_marginLeft="10dp"
      android:layout_toRightOf="@+id/painting"
      android:layout_toEndOf="@+id/painting"
      android:background="@drawable/ruhesi_buttondesigns"
      android:onClick="toggling"
      android:text="@string/playing_instruments"
      android:textColor="#FF4444" /&gt;
  &lt;Button
      android:id="@+id/pets"
      android:layout_width="wrap_content"
      android:layout_height="30dp"
      android:layout_toRightOf="@+id/playing_instruments"
      android:layout_toEndOf="@+id/playing_instruments"
      android:layout_marginLeft="10dp"
      android:background="@drawable/ruhesi_buttondesigns"
      android:onClick="toggling"
      android:text="@string/playing_instruments"
      android:textColor="#FF4444" /&gt;
      &lt;/Linear&gt;
  </code></pre>
  
  <p>So this generates me this picture:
  <a href="http://i.stack.imgur.com/1O2I1.jpg" rel="nofollow">Located</a></p>
  
  <p>So as we all now each device has a different screen size so in big device probably all these buttons will be in one line alligned but in smaller screen I want that buttons to be alligned (for example last button not visible it should go to below). So in one row there can be 3 buttons on the second row there can be 2 buttons depends on the text of the button and next row maybe again 3 buttons. How we can give this flexibility ?</p>