title: Programmatically add a View to the bottom of the screen
body: <p>I want to add a View at the bottom of an existing layout, regardless of the type of ViewGroup (Linear, Relative etc...) which is defined in the Activity layout file</p>
  
  <p>The Activity layout file looks like this:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Get Ad"
      android:layout_centerInParent="true"
      android:onClick="showAdd"/&gt;
   &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and this is the code for placing the View:</p>
  
  <pre><code>ViewGroup rootView = (ViewGroup)((Activity) m_context).findViewById(android.R.id.content);
  RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT,
              RelativeLayout.LayoutParams.MATCH_PARENT);
      lay.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      rootView.addView(adView,lay);
  </code></pre>
  
  <p>The problem is that the View appears in the middle of the screen and not at the bottom, as expected</p>