title: How to place ViewPager in NavigationDrawer Correctly
body: <p>I am trying to use ViewPager in one of NavigationDrawer fragment, but this happens:</p>
  
  <p><a href="https://i.imgur.com/dJGApSn.png" rel="nofollow noreferrer"><img src="https://i.imgur.com/dJGApSn.png" alt="Screenshot"></a></p>
  
  <p>As you see, navigationDrawer is under ViewPager, and I want to use ViewPager in only one fragment of NavDrawer. When i click on for example "Gallery" NavDrawer stay on screen, and everytime i click on "Import" (There i want to place VIewPager), this happens:
  <a href="https://i.imgur.com/hG4PuKU.png" rel="nofollow noreferrer"><img src="https://i.imgur.com/hG4PuKU.png" alt="enter image description here"></a></p>
  
  <p>My MainActivity:</p>
  
  <pre><code>    package com.example.qiteq.integration;
  
  import android.os.Bundle;
  import android.support.design.widget.NavigationView;
  import android.support.v4.app.Fragment;
  import android.support.v4.view.GravityCompat;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.widget.Toolbar;
  import android.view.MenuItem;
  
  public class MainActivity extends ActionBarActivity
          implements NavigationView.OnNavigationItemSelectedListener {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                  this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
          drawer.setDrawerListener(toggle);
          toggle.syncState();
  
          NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
          navigationView.setNavigationItemSelectedListener(this);
  
      }
  
      @Override
      public void onBackPressed() {
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          if (drawer.isDrawerOpen(GravityCompat.START)) {
              drawer.closeDrawer(GravityCompat.START);
          } else {
              super.onBackPressed();
          }
      }
  
  
      @SuppressWarnings("StatementWithEmptyBody")
      @Override
      public boolean onNavigationItemSelected(MenuItem item) {
          // Handle navigation view item clicks here.
          int id = item.getItemId();
  
          if (id == R.id.nav_camera) {
              Fragment fragment = new ViewFragment();
              getSupportFragmentManager().beginTransaction().replace(R.id.fragmentTarget, fragment).commit();
          } else if (id == R.id.nav_gallery) {
  
          } else if (id == R.id.nav_slideshow) {
  
          } else if (id == R.id.nav_manage) {
  
          } else if (id == R.id.nav_share) {
  
          } else if (id == R.id.nav_send) {
  
          }
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          drawer.closeDrawer(GravityCompat.START);
          return true;
      }
  
  }
  </code></pre>
  
  <p>ViewFragment:</p>
  
  <pre><code>    package com.example.qiteq.integration;
  
  import android.os.Bundle;
  import android.support.design.widget.NavigationView;
  import android.support.v4.app.Fragment;
  import android.support.v4.view.GravityCompat;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.widget.Toolbar;
  import android.view.MenuItem;
  
  public class MainActivity extends ActionBarActivity
          implements NavigationView.OnNavigationItemSelectedListener {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  //        setSupportActionBar(toolbar);
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                  this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
          drawer.setDrawerListener(toggle);
          toggle.syncState();
  
          NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
          navigationView.setNavigationItemSelectedListener(this);
  
      }
  
      @Override
      public void onBackPressed() {
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          if (drawer.isDrawerOpen(GravityCompat.START)) {
              drawer.closeDrawer(GravityCompat.START);
          } else {
              super.onBackPressed();
          }
      }
  
  
      @SuppressWarnings("StatementWithEmptyBody")
      @Override
      public boolean onNavigationItemSelected(MenuItem item) {
          // Handle navigation view item clicks here.
          int id = item.getItemId();
  
          if (id == R.id.nav_camera) {
              Fragment fragment = new ViewFragment();
              getSupportFragmentManager().beginTransaction().replace(R.id.fragmentTarget, fragment).commit();
          } else if (id == R.id.nav_gallery) {
  
          } else if (id == R.id.nav_slideshow) {
  
          } else if (id == R.id.nav_manage) {
  
          } else if (id == R.id.nav_share) {
  
          } else if (id == R.id.nav_send) {
  
          }
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          drawer.closeDrawer(GravityCompat.START);
          return true;
      }
  
  }
  </code></pre>
  
  <p>SectionsPagerAdapter:</p>
  
  <pre><code>    package com.example.qiteq.integration;
  
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  
  public class SectionsPagerAdapter extends FragmentPagerAdapter {
      public SectionsPagerAdapter(FragmentManager fm){
          super(fm);
      }
  
      @Override
      public Fragment getItem(int position){
          Fragment fragment = new DummySectionsFragment();
          return fragment;
      }
  
      @Override
      public int getCount(){
          return 3;
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          switch (position){
              case 0:
                  return "Section 1";
              case 1:
                  return "Section 2";
              case 2:
                  return "Section 3";
          }
          return null;
      }
  
  }
  </code></pre>
  
  <p>DummySectionsFragment:</p>
  
  <pre><code>    package com.example.qiteq.integration;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  /**
   * Created by Qiteq on 05.08.2016.
   */
  public class DummySectionsFragment extends Fragment {
      public DummySectionsFragment(){}
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
          View rootView = inflater.inflate(R.layout.layout2, container, false);
          return rootView;
      }
  }
  </code></pre>
  
  <p>content_main.xml (NavDrawer)</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/fragmentTarget"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      tools:context="com.example.qiteq.integration.MainActivity"
      tools:showIn="@layout/app_bar_main"&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>layout.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/pager"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  </code></pre>
  
  <p>layout2.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.view.ViewPager android:id="@+id/pager"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:android="http://schemas.android.com/apk/res/android" /&gt;
  </code></pre>
  
  <p>The whole project download: <a href="https://drive.google.com/file/d/0B_yo7L-EKsdpQUNCejAxdTZPSW8/view?usp=sharing" rel="nofollow noreferrer" title="link">Link</a>
  My question is, how can i use ViewPager in only one fragment of NavDrawer?</p>