title: Show DialogFragment over TabLayout
body: <p>I'm trying to show a DialogFragment full-screen such that the ActionBar is still visible but the tabs in a TabLayout are hidden.</p>
  
  <p>The image <strong>on the left</strong> is what I've managed to achieve; the image <strong>on the right</strong> is what I'm aiming for:</p>
  
  <p><img src="https://i.stack.imgur.com/Cx4Nn.png" alt="enter image description here"></p>
  
  <p>There are two issues:</p>
  
  <ol>
  <li>The tabs are still shown, which the user can interact with;</li>
  <li>Because of the extra <code>FrameLayout</code> to show the dialog, the <code>ViewPager</code> content is still visible (the FAB button is not part of the dialog). This also means that the user can interact with the content in the pager, which includes the ability to change tabs.</li>
  </ol>
  
  <p><strong>Main Activity Layout (main.xml)</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;android.support.design.widget.CoordinatorLayout
          android:id="@+id/toolbar_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;!-- Use ThemeOverlay to make the toolbar and tablayout text
               white --&gt;
          &lt;android.support.design.widget.AppBarLayout
              android:id="@+id/abl_top"
              android:layout_height="wrap_content"
              android:layout_width="match_parent"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
              &lt;android.support.v7.widget.Toolbar
                  android:id="@+id/toolbar"
                  android:fitsSystemWindows="true"
                  android:layout_height="wrap_content"
                  android:layout_width="match_parent"
                  app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                  app:layout_scrollFlags="scroll|enterAlways"/&gt;
  
              &lt;android.support.design.widget.TabLayout
                  android:id="@+id/tab_layout"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  style="@style/CustomTabStyle"/&gt;
  
          &lt;/android.support.design.widget.AppBarLayout&gt;
      &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
      &lt;FrameLayout
          android:id="@+id/content"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
      &lt;/FrameLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.example.app;
  
  import android.content.Context;
  import android.graphics.drawable.Drawable;
  import android.os.Bundle;
  import android.support.design.widget.TabLayout;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.ActionBar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.text.Spannable;
  import android.text.SpannableString;
  import android.text.style.ImageSpan;
  import android.util.Log;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class MainActivity
      extends AppCompatActivity
  {
      private static final String TAG = "MainActivity";
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          // Setup AppBar
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          if (toolbar != null) {
              setSupportActionBar(toolbar);
          }
  
          // Setup ViewPager
          ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
          if (viewPager != null) {
              setupViewPager(viewPager);
          }
  
          // Setup TabLayout
          TabLayout tl = (TabLayout) findViewById(R.id.tab_layout);
          tl.setupWithViewPager(viewPager);
      }
  
      @Override
      public void onBackPressed() {
          super.onBackPressed();
      }
  
      private void setupViewPager(ViewPager viewPager) {
          Adapter adapter = new Adapter(
              getSupportFragmentManager(), MainActivity.this);
          adapter.addFragment(
              new Fragment1(),
              "Tab 1", R.drawable.numeric_1_box_outline);
          adapter.addFragment(
              new Fragment2(),
              "Tab 2", R.drawable.numeric_2_box_outline);
          viewPager.setAdapter(adapter);
      }
  
      static class Adapter extends FragmentPagerAdapter {
          private final List&lt;Fragment&gt; mFragments = new ArrayList&lt;&gt;();
          private final List&lt;Integer&gt; mFragmentIcons = new ArrayList&lt;&gt;();
          private final List&lt;String&gt; mFragmentTitles = new ArrayList&lt;&gt;();
          private Context context;
  
          public Adapter(FragmentManager fm, Context context) {
              super(fm);
              this.context = context;
          }
  
          public void addFragment(Fragment fragment, String title, int iconId) {
              mFragments.add(fragment);
              mFragmentTitles.add(title);
              mFragmentIcons.add(iconId);
          }
  
          @Override
          public Fragment getItem(int position) {
              return mFragments.get(position);
          }
  
          @Override
          public int getCount() {
              return mFragments.size();
          }
  
          @Override
          public CharSequence getPageTitle(int position) {
              Drawable image = context.getResources().getDrawable(
                      mFragmentIcons.get(position), null);
              image.setBounds(0, 0, image.getIntrinsicWidth(),
                      image.getIntrinsicHeight());
              SpannableString sb = new SpannableString("   " + mFragmentTitles.get(position));
              ImageSpan imageSpan = new ImageSpan(image, ImageSpan.ALIGN_BOTTOM);
              sb.setSpan(imageSpan, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
              return sb;
          }
       }
  
  }
  </code></pre>