title: Android: Two Views On Top of Each Other Using XML
body: <p>I want to display two views on a screen.  One is a randomly positioned dot bitmaps. I can get that do display with setContentView(...).
  I also have two bitmaps and a textview that are arranged via xml layout language and then using setContentView(R.layout.activity_title);</p>
  
  <hr>
  
  <p><strong>DrawV.java</strong>
  !!!BASICALLY I THINK I HAVE TWO setContentViews(...) THAT I WANT TO DISPLAY AT THE SAME TIME.  TELL ME IF YOU WANT MORE INFORMATION.</p>
  
  <hr>
  
  <p>public class DrawV extends View {
      VARIABES...</p>
  
  <p>public DrawV(Context context) {
      CREATE CIRCLES (CIRCLE OBJECTS) STORING COORDINATES RANDOMLY CHOSEN...</p>
  
  <p>@Override
  protected void onDraw(Canvas canvas) {
      DRAW THESE CIRCLES AS BITMAPS...SCREEN IS NOW RANDOMLY COVERED WITH MANY DOTS
  }</p>
  
  <hr>
  
  <p><strong>GameActivity.java</strong>  </p>
  
  <hr>
  
  <p>public class GameActivity extends Activity {
      private DrawV drawView;</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      drawView = new DrawV(this);
       setContentView(R.layout.activity_title);    !!!SHOWS LAYOUT (HOPEFULLY TEXTVIEW, TWO BUTTONS, AND RANDOMLY POSITIONED DOTS (DOTS NEVER WORKS) WHICH IS OVERDONE BY DRAWVIEW...
       setContentView(drawView); !!!IF THIS STATEMENT IS SECOND IT RENDERS INTEAD OF THE PREVIOUS STATEMENT.  OTHERWISE activity_title shows.
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      DEFAULT CODE...
  }
  </code></pre>
  
  <p>}</p>
  
  <p>!!!THE WORST OFFENDER: activity_title.xml</p>
  
  <hr>
  
  <p><strong>activity_title.xml</strong></p>
  
  <hr>
  
  <p>!!!I AM NOT SURE HOW TO WRITE THIS. IT DOESN'T CURRENTLY WORK.
  I want to display two views on a screen.  One is a randomly positioned dot bitmaps. I can get that do display with setContentView(...).
  I also have two bitmaps and a textview that are arranged via xml layout language and then using setContentView(R.layout.controls...);</p>
  
  <hr>
  
  <p>DrawV.java
  !!!BASICALLY I THINK I HAVE TWO setContentViews(...) THAT I WANT TO DISPLAY AT THE SAME TIME.  TELL ME IF YOU WANT MORE INFORMATION.</p>
  
  <hr>
  
  <p>public class DrawV extends View {
      VARIABES...</p>
  
  <p>public DrawV(Context context) {
      CREATE CIRCLES (CIRCLE OBJECTS) STORING COORDINATES RANDOMLY CHOSEN...</p>
  
  <p>@Override
  protected void onDraw(Canvas canvas) {
      DRAW THESE CIRCLES AS BITMAPS...SCREEN IS NOW RANDOMLY COVERED WITH MANY DOTS
  }</p>
  
  <hr>
  
  <p>GameActivity.java  !!!STARTING .JAVA</p>
  
  <hr>
  
  <p>public class GameActivity extends Activity {
      private DrawV drawView;</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      drawView = new DrawV(this);
       setContentView(R.layout.activity_title);    !!!SHOWS LAYOUT (HOPEFULLY TEXTVIEW, TWO BUTTONS, AND RANDOMLY POSITIONED DOTS (DOTS NEVER WORKS) WHICH IS OVERDONE BY DRAWVIEW...
       setContentView(drawView); !!!IF THIS STATEMENT IS SECOND IT RENDERS INTEAD OF THE PREVIOUS STATEMENT.  OTHERWISE activity_title shows.
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      DEFAULT CODE...
  }
  </code></pre>
  
  <p>}</p>
  
  <p>!!!THE WORST OFFENDER: activity_title.xml</p>
  
  <hr>
  
  <p>activity_title.xml</p>
  
  <hr>
  
  <pre><code>!!!I AM NOT SURE HOW TO WRITE THIS. IT DOESN'T CURRENTLY WORK.
  &lt;?xml version="1.0" encoding="utf-8"?&gt;  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
          &lt;LinearLayout
              android:orientation="vertical"
              android:gravity="center"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="20dp" &gt;
                  &lt;TextView
                  android:textColor="#ff0000"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:textSize="40sp"
                  android:text="@string/timer"
                  android:id="@+id/timer"&gt;
                  &lt;/TextView&gt;
                  &lt;LinearLayout
                  android:orientation="horizontal"
                  android:layout_gravity="center_horizontal"
                  android:gravity="center"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"&gt;
  &lt;Button
                      android:layout_marginLeft="20dp"
                      android:background="@drawable/stopbutton"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:layout_weight="1"
                      android:text="@string/stopText"
                      android:id="@+id/stopButton"
                      android:visibility="gone"&gt;
                      &lt;/Button&gt;
                      &lt;Button
                      android:layout_marginLeft="20dp"
                      android:background="@drawable/startbutton"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:layout_weight="1"
                      android:text="@string/startText"
                      android:id="@+id/startButton"&gt;
                      &lt;/Button&gt;
                      &lt;Button
                      android:layout_marginRight="20dp"
                      android:background="@drawable/resetbutton"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center"
                      android:layout_weight="1"                   
                      android:text="@string/resetText"
                      android:id="@+id/resetButton"&gt;
                      &lt;/Button&gt;
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout  !!!MESSED UP CODE. DON'T KNOW HOW TO SHOW DOTS USING XML
              android:orientation="horizontal"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"&gt;
                   &lt;View class="com.category.tap.DrawV"
                  android:id="@+id/dotpic"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent" /&gt;
              &lt;/LinearLayout&gt;
  
  
   &lt;/RelativeLayout&gt;  
  </code></pre>
  
  <p>If anyone needs more information, let me know.      </p>