title: Why are my tab views transparent?
body: <p>Working on the New Boston tutorials (I highly recommend them if you know anybody trying to learn android).  I'm currently working through tabs.  I have a few setup but you can see and interact with all tab contents behind the one "on top".  How do I stop that?  I tried adding a background in each of the linearlayouts that make up each tab but all that did was make them see through with different colored backgrounds.  The image at the bottom shows the left tab on top, but buttons/text views from the 2nd and 3rd tab showing through.  I need each tab to only show what in that tab, not in tabs behind the top one.</p>
  
  <p>Java:</p>
  
  <pre><code>    package com.thenewboston.psest328;
  
      import android.app.Activity;
      import android.os.Bundle;
      import android.view.View;
      import android.view.View.OnClickListener;
      import android.widget.Button;
      import android.widget.TabHost;
      import android.widget.TabHost.TabSpec;
      import android.widget.TextView;
  
      public class Tabs extends Activity implements OnClickListener {
  
          TabHost th;
          Button newTab, bStart, bStop;
          TextView showResults;
          long start;
          long stop;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
              setContentView(R.layout.tabs);
  
              th = (TabHost)findViewById(R.id.tabhost);
              newTab = (Button)findViewById(R.id.bAddTab);
              bStart = (Button)findViewById(R.id.bStartWatch);
              bStop = (Button)findViewById(R.id.bStopWatch);
              showResults = (TextView)findViewById(R.id.tvShowResults);
              th.setup();
  
              newTab.setOnClickListener(this);
              bStart.setOnClickListener(this);
              bStop.setOnClickListener(this);
  
              TabSpec spec = th.newTabSpec("tag1");
              spec.setContent(R.id.tab1);
              spec.setIndicator("StopWatch");
              th.addTab(spec);
  
              spec = th.newTabSpec("tag2");
              spec.setContent(R.id.tab2);
              spec.setIndicator("Tab 2");
              th.addTab(spec);
  
              spec = th.newTabSpec("tag3");
              spec.setContent(R.id.tab2);
              spec.setIndicator("Add Tab");
              th.addTab(spec);
          }
  
          @Override
          public void onClick(View view) {
  
          // TODO Auto-generated method stub
          switch(view.getId()) {
          case R.id.bAddTab:
  
              TabSpec ourSpec = th.newTabSpec("tag1");
              ourSpec.setContent(new TabHost.TabContentFactory() {
  
                  @Override
                  public View createTabContent(String tag) {
                      // TODO Auto-generated method stub
  
                      TextView text = new TextView(Tabs.this);
                      text.setText("You've created a new tab");
                      return text;
                  }
              });
              ourSpec.setIndicator("New");
              th.addTab(ourSpec);
  
              break;
  
          case R.id.bStartWatch:
              start = 0;
              start = System.currentTimeMillis();
              break;
  
          case R.id.bStopWatch:
              stop = System.currentTimeMillis();
  
              if(start != 0) {
                  long result = stop - start;
                  showResults.setText(Long.toString(result));
              }
              break;
          }
      }
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TabHost
          android:id="@+id/tabhost"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" &gt;
  
              &lt;TabWidget
                  android:id="@android:id/tabs"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
              &lt;/TabWidget&gt;
  
              &lt;FrameLayout
                  android:id="@android:id/tabcontent"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab1"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
  
                      &lt;Button
                          android:id="@+id/bStartWatch"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Start" /&gt;
  
                      &lt;Button
                          android:id="@+id/bStopWatch"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Stop" /&gt;
  
                      &lt;TextView
                          android:id="@+id/tvShowResults"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="TextView" /&gt;
  
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab2"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
  
                      &lt;TextView
                          android:id="@+id/textView3"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="TextView 3" /&gt;
  
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/tab3"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent" &gt;
  
                      &lt;Button
                          android:id="@+id/bAddTab"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Add Tab" /&gt;                    
  
                  &lt;/LinearLayout&gt;
              &lt;/FrameLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/TabHost&gt;    
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What it looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/AGB5y.jpg" alt="enter image description here"></p>