title: Navigation drawer is under other widgets
body: <p>I'm trying to add <strong>fragment with Navigation drawer</strong> to the main activity, where are two buttons. However, when Navigation drawer is opened, buttons are <strong>above</strong> it. Moreover, Navigation drawer is <strong>not clickable</strong>, but buttons are.</p>
  
  <p><a href="https://i.stack.imgur.com/XDUtm.png" rel="nofollow noreferrer">Screenshot of opened Navigation drawer</a></p>
  
  <p>Here is my code.</p>
  
  <p><strong>XML File implementing Navigation Drawer - MainActivity.xml</strong></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:layout_width="match_parent"
  android:layout_height="match_parent"
  android:theme="@style/Theme.AppCompat.Light.NoActionBar"
  tools:context=".MainActivity"&gt;
  
  
  &lt;Button
      android:id="@+id/mainTestsButton"
      android:layout_width="112dp"
      android:layout_height="105dp"
      android:layout_alignParentEnd="true"
      android:layout_marginTop="334dp"
      android:layout_marginEnd="167dp"
      android:onClick="goTest"
      android:text="Button2"
      android:visibility="visible"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/mainLearningButton"
      android:layout_width="114dp"
      android:layout_height="102dp"
      android:layout_alignParentEnd="true"
      android:layout_marginLeft="20dp"
      android:layout_marginTop="108dp"
      android:layout_marginEnd="175dp"
      android:layout_marginBottom="118dp"
      android:onClick="goLearn"
      android:text="Button1"
      android:visibility="visible"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
      &lt;fragment
          android:id="@+id/fragmentList"
          android:name="com.chemistryApps.NavigationDrawer"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          tools:layout="@layout/fragment_navigation_drawer" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Navigation Drawer XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout 
  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/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true"
  android:theme="@style/Theme.AppCompat.Light.NoActionBar"
  tools:context=".NavigationDrawer"&gt;
  
  &lt;android.support.constraint.ConstraintLayout
      android:id="@+id/constraintLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHorizontal_bias="0.0"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      app:layout_constraintVertical_bias="0.0"&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  
  &lt;FrameLayout
      android:id="@+id/content_frame"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  &lt;/FrameLayout&gt;
  
  &lt;android.support.design.widget.NavigationView
      android:id="@+id/nav_view"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:fitsSystemWindows="true"
      app:headerLayout="@layout/nav_header"
      app:menu="@menu/menu_layout" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><strong>Navigation Drawer Fragment Java class</strong></p>
  
  <pre><code>import android.content.Context;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.support.annotation.NonNull;
  import android.support.design.widget.NavigationView;
  import android.support.v4.app.Fragment;
  import android.support.v4.widget.DrawerLayout;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AbsListView;
  
  
  public class NavigationDrawer extends Fragment {
  
  private DrawerLayout mDrawerLayout;
  NavigationView navigationView;
  
  private OnFragmentInteractionListener mListener;
  
  public NavigationDrawer() {
      // Required empty public constructor
  }
  
  public static NavigationDrawer newInstance(String param1, String param2) {
      NavigationDrawer fragment = new NavigationDrawer();
      Bundle args = new Bundle();
      fragment.setArguments(args);
      return fragment;
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  
      }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      Log.i("buttonClicked", "onCreateView");
      View view = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
  
      mDrawerLayout = view.findViewById(R.id.drawer_layout);
  
      navigationView = view.findViewById(R.id.nav_view);
  
      mDrawerLayout.addDrawerListener(new DrawerLayout.DrawerListener() {
          @Override
          public void onDrawerSlide(@NonNull View view, float v) {
              Log.i("buttonClicked", "onDrawerOpened");
          }
  
          @Override
          public void onDrawerOpened(@NonNull View view) {
              Log.i("buttonClicked", "onDrawerOpened");
              navigationView.bringToFront();
              mDrawerLayout.requestLayout();
          }
  
          @Override
          public void onDrawerClosed(@NonNull View view) {
              Log.i("buttonClicked", "onDrawerOpened");
          }
  
          @Override
          public void onDrawerStateChanged(int i) {
              Log.i("buttonClicked", "onDrawerOpened");
          }
      });
  
  
      navigationView.setNavigationItemSelectedListener(
              new NavigationView.OnNavigationItemSelectedListener() {
                  @Override
                  public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
                      // set item as selected to persist highlight
                      Log.i("buttonClicked", "onNavigationItemSelected()" + menuItem.toString());
                      menuItem.setChecked(true);
                      // close drawer when item is tapped
                      mDrawerLayout.closeDrawers();
  
                      // Add code here to update the UI based on the item selected
                      switch (menuItem.getItemId()){
                          case R.id.learning:
                              Intent intent = new Intent(getActivity(), LearningActivity.class);
                              startActivity(intent);
                              return true;
                          case R.id.test:
                              Intent intent2 = new Intent(getActivity(), TestActivity.class);
                              startActivity(intent2);
                              return true;
                          case R.id.settings:
                              return true;
                          case R.id.help:
                              return true;
                          default:
                              return false;
  
                      }
  
  
                  }
              });
  
      return inflater.inflate(R.layout.fragment_navigation_drawer, container, 
  false);
  }
  
  
  @Override
  public void onAttach(Context context) {
      super.onAttach(context);
      if (context instanceof OnFragmentInteractionListener) {
          mListener = (OnFragmentInteractionListener) context;
      } else {
          throw new RuntimeException(context.toString()
                  + " must implement OnFragmentInteractionListener");
      }
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
      mListener = null;
  }
  
  public interface OnFragmentInteractionListener {
      void onFragmentInteraction(Uri uri);
  }
  }
  </code></pre>
  
  <p>Thank you in advance for an answer.</p>
  
  <p><strong>EDIT:</strong>
  I am attaching the <strong>main activity code</strong></p>
  
  <pre><code>import android.content.Intent;
  import android.net.Uri;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  
  public class MainActivity extends AppCompatActivity implements 
  NavigationDrawer.OnFragmentInteractionListener {
  
  
  
  public void goLearn (View view){
      Log.i("buttonClicked", "goLearn");
      final Intent intent = new Intent(this, LearningActivity.class);
      startActivity(intent);
  }
  
  public void goTest (View view){
      Log.i("buttonClicked", "goTest");
      final Intent intent = new Intent(this, TestActivity.class);
      startActivity(intent);
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  }
  
  @Override
  public void onFragmentInteraction(Uri uri) {
      return;
  }
  }
  </code></pre>