title: Android navigation drawer right side not working
body: <p>I have a navigation drawer and I try to change its opening position. I want  my navigation drawer to open on the right side.</p>
  
  <p>This is my navigation drawer xml code:</p>
  
  <pre><code>&lt;ge.me.custom.CustomDrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/drawer_layout5"
  android:layout_width="200dp"
  android:layout_height="match_parent" &gt;
  &lt;FrameLayout
      android:id="@+id/content_frame"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  &lt;!-- The navigation drawer --&gt;
  &lt;LinearLayout
      android:id="@+id/drawer"
      android:layout_width="200dp"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:background="#09b52f"
      android:orientation="vertical" &gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;RelativeLayout
              android:id="@+id/slidemenumainlayout"
              android:layout_width="match_parent"
              android:layout_height="120dp"
              android:layout_alignParentLeft="true"
              android:layout_alignParentTop="true" &gt;
  
              &lt;ImageView
                  android:id="@+id/slidemenuuserimage"
                  android:layout_width="70dp"
                  android:layout_height="70dp"
                  android:layout_alignParentBottom="true"
                  android:layout_alignParentLeft="true"
                  android:layout_marginBottom="16dp"
                  android:layout_marginLeft="14dp"
                  android:background="@drawable/ic_user_blue" /&gt;
  
          &lt;/RelativeLayout&gt;
  
          &lt;ListView
              android:id="@+id/drawer_list"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_alignRight="@+id/slidemenumainlayout"
              android:layout_below="@+id/slidemenumainlayout"
              android:divider="#00af25"
              android:dividerHeight="1dp" &gt;
          &lt;/ListView&gt;
      &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is my custom drawer:</p>
  
  <pre><code>public class CustomDrawerLayout extends DrawerLayout {
  
      public CustomDrawerLayout(Context context) {
          super(context);
      }
  
      public CustomDrawerLayout(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      public CustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
      }
  
      @Override
      protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          widthMeasureSpec = MeasureSpec.makeMeasureSpec(
              MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY);
          heightMeasureSpec = MeasureSpec.makeMeasureSpec(
              MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
          super.onMeasure(widthMeasureSpec, heightMeasureSpec);
      }
  
  }
  </code></pre>
  
  <p>And this code is inside the main activity:</p>
  
  <pre><code>  mDrawerToggle = new ActionBarDrawerToggle(getActivity(), mDrawerLayout,
              R.drawable.ic_drawer, R.string.app_name,
              R.string.app_name) {
  
          @Override
          public boolean onOptionsItemSelected(MenuItem item) {
              if (item != null &amp;&amp; item.getItemId() == android.R.id.home) {
                  if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) {
                      mDrawerLayout.closeDrawer(Gravity.RIGHT);
                  } else {
                      mDrawerLayout.openDrawer(Gravity.RIGHT);
                  }
              }
              return false;
          }
      };
  
      mDrawerLayout.setDrawerListener(mDrawerToggle);
  </code></pre>
  
  <p>I wrote a method to open my drawer on the right side but when I run my app, it crashes.</p>
  
  <pre><code>public void openDrawer(int gravity) {
      mDrawerLayout.openDrawer(gravity);
  }
  openDrawer(Gravity.RIGHT);
  </code></pre>
  
  <p>If I call the method like this:</p>
  
  <pre><code>openDrawer(Gravity.START);
  </code></pre>
  
  <p>I do not get an error but the navigation drawer's start position is left.</p>
  
  <p>This is my error:</p>
  
  <pre class="lang-none prettyprint-override"><code>java.lang.IllegalArgumentException: No drawer view found with gravity RIGHT
  </code></pre>
  
  <p>How can I open the navigation drawer on the right side?</p>