title: ActionBar tabs with ViewPager and Frame Layout
body: <p>I was wanting to use ActionBar tabs and ViewPager to implement swiping between tabs. I have successfully used the example here:</p>
  
  <p><a href="http://developer.android.com/reference/android/support/v4/view/ViewPager.html" rel="nofollow">http://developer.android.com/reference/android/support/v4/view/ViewPager.html</a></p>
  
  <p>However, I also wanted to add a Frame Layout outside of the ViewPager in the xml: </p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/LinearLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".MainActivity" &gt;
  
      &lt;android.support.v4.view.ViewPager
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/FrameLayout1"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"&gt;
      &lt;/android.support.v4.view.ViewPager&gt;   
  
      &lt;FrameLayout
          android:id="@+id/frame_layout"
          android:name="com.banagas.calculator.ButtonFragment"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>If I set the setContentView() to my layout with both the ViewPager and Frame Layout, the ViewPager stops functioning: </p>
  
  <pre><code>@Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Log.i("MainActivity", "onCreate");  
          mViewPager = new ViewPager(this);
          mViewPager.setId(R.id.FrameLayout1);
          ActionBar bar = getSupportActionBar();
          mViewPager.setOffscreenPageLimit(4);
  
          bar.setDisplayHomeAsUpEnabled(false);
          bar.setDisplayShowTitleEnabled(false);
          bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
          mTabsAdapter = new TabsAdapter(this, mViewPager);
  
          mTabsAdapter.addTab(bar.newTab().setText("Display"), DisplayFragment.class, null);
          mTabsAdapter.addTab(bar.newTab().setText("Y="), YFragment.class, null);
          mTabsAdapter.addTab(bar.newTab().setText("Graph"), GraphFragment.class, null);
          mTabsAdapter.addTab(bar.newTab().setText("Table"), TableFragment.class, null);
  
          if (findViewById(R.id.frame_layout) != null) 
          {
              if (savedInstanceState != null) 
              {
                  return;
              }
              getSupportFragmentManager().beginTransaction().add(R.id.frame_layout, new ButtonFragment()).commit();
              Log.i("MainActivity", "add.ButtonFragment");
          }
      }
  </code></pre>
  
  <p>I can see the tabs and nothing else within the ViewPager. My Frame Layout works perfectly fine though. How would I get ViewPager to work with this?</p>