title: Trying to add buttons at the end of a RelativeLayout in Android
body: <p>Hi =)  I am trying to develop an app in android, and its a basic text adventure game, which displays some text, and then has a couple of buttons for the options you can choose.  Very very basic. However the text goes into a TextView which is dynamically changed every time a button is pressed to generate the next part of the story.  And my buttons, are also dynamically generated on the fly. I think that due to this, they don't generate underneath the TextView as it shows in the layout tree.  Regardless, here is my code.  My question mainly is how do i make the buttons show up at the bottom of the scrollable TextView, compared to the top?  And secondly, if anyone could allow me to have this info, how do i clear the button layout so that i can create some more buttons?  If either of these get asked it would be very helpful.  Thanks! ^-^</p>
  
  <p>Java:</p>
  
  <pre><code>package toymakersdev.com.theinsane;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.method.ScrollingMovementMethod;
  import android.view.ViewGroup;
  import android.widget.AbsListView;
  import android.widget.Button;
  import android.widget.LinearLayout;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import org.w3c.dom.Text;
  
  public class GameActivity extends AppCompatActivity {
  
  private TextView storyText;
  private LinearLayout buttonLayout;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_game);
  
      buttonLayout = (LinearLayout)findViewById(R.id.buttonLayout);
  
      storyText = (TextView)findViewById(R.id.storyText);
      storyText.setMovementMethod(new ScrollingMovementMethod());
  
      storyText.setText("Blah Blah Blah");
  
      Button button1 = new Button(this);
      Button button2 = new Button(this);
      button1.setText("Button1");
      button2.setText("Button2");
  
      button1.setLayoutParams(new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT,
              ViewGroup.LayoutParams.WRAP_CONTENT));
      button2.setLayoutParams(new ViewGroup.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT,
              ViewGroup.LayoutParams.WRAP_CONTENT));
  
      buttonLayout.addView(button1);
      buttonLayout.addView(button2);
  }
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="toymakersdev.com.theinsane.GameActivity"
  android:background="#000000"
  android:padding="10dp"&gt;
  
  &lt;ScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:id="@+id/scrollView"
      android:padding="10dp"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/storyText"
              android:textColor="#ffffff"
              android:textAlignment="center"
              android:textSize="32sp"/&gt;
  
          &lt;LinearLayout
              android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/buttonLayout"&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/RelativeLayout&gt;
  &lt;/ScrollView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>