title: Error with DrawerLayout and RelativeLayout
body: <p>I have <code>RelativeLayout</code> within <code>DrawerLayout</code> this is my xml file:</p>
  <h1>Activity_main.xml</h1>
  <pre><code>&lt;android.support.v4.widget.DrawerLayout
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:id=&quot;@+id/drawer_layout&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;com.wunderlist.slidinglayer.SlidingLayer
              android:id=&quot;@+id/slidingLayer1&quot;
              android:layout_width=&quot;@dimen/layer_size&quot;
              android:layout_height=&quot;match_parent&quot;
  
          &gt;
  
          &lt;RelativeLayout
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;match_parent&quot;
                  android:background=&quot;#14ad8f&quot;
             &gt;
  
              &lt;Button
                      android:id=&quot;@+id/buttonClose&quot;
                      style=&quot;@style/ButtonRed&quot;
                      android:onClick=&quot;buttonClicked&quot;
                      android:layout_marginBottom=&quot;60dp&quot;
                      android:layout_alignParentBottom=&quot;true&quot;
                      android:layout_centerHorizontal=&quot;true&quot;
                      android:text=&quot;@string/close_button_container&quot;/&gt;
  
  
              &lt;TextView
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:textAppearance=&quot;?android:attr/textAppearanceMedium&quot;
                  android:text=&quot;Nosaukums&quot;
                  android:id=&quot;@+id/fragNosaukums&quot; /&gt;
          &lt;/RelativeLayout&gt;
  
  
  
      &lt;/com.wunderlist.slidinglayer.SlidingLayer&gt;
  
      &lt;FrameLayout android:id=&quot;@+id/container&quot; android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot; /&gt;
  
      &lt;fragment android:id=&quot;@+id/navigation_drawer&quot;
          android:layout_width=&quot;@dimen/navigation_drawer_width&quot; android:layout_height=&quot;match_parent&quot;
          android:layout_gravity=&quot;start&quot;
          android:name=&quot;com.wunderlist.slidinglayersample.NavigationDrawerFragment&quot;
          tools:layout=&quot;@layout/fragment_navigation_drawer&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/map&quot;
          android:name=&quot;com.google.android.gms.maps.MapFragment&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          /&gt;
  
  
  
  
  
      &lt;!--android:name=&quot;com.wunderlist.slidinglayersample.NavigationDrawerFragment&quot;--&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  <p>And this is my java code:</p>
  <h1>MainActivity.java:</h1>
  <pre><code>public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks {
  
      private NavigationDrawerFragment mNavigationDrawerFragment;
      private CharSequence mTitle;
      private GoogleMap googleMap;
      private String urlJsonObj = &quot;http://api.androidhive.info/volley/person_object.json&quot;;
      private String urlJsonArry = &quot;http://heimerdinger.pe.hu/getjson.php&quot;;
      private static String TAG = MainActivity.class.getSimpleName();
      private ProgressDialog pDialog;
      Content content = new Content();
      public static String valueEntered;
      private String jsonResponse;
      private SlidingLayer mSlidingLayer;
      private TextView swipeText, fragNosaukums;
      public String name;
      public Marker marker;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          mNavigationDrawerFragment = (NavigationDrawerFragment)
                  getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
          mTitle = getTitle();
  
          // Set up the drawer.
          mNavigationDrawerFragment.setUp(
                  R.id.navigation_drawer,
                  (DrawerLayout) findViewById(R.id.drawer_layout));
  
  
  
  
         // fragNosaukums = (TextView) findViewById(R.id.fragNosaukums);
  
          googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
          googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
          googleMap.getUiSettings();
          googleMap.getUiSettings().setZoomControlsEnabled(true);
          googleMap.setMyLocationEnabled(true);
  
          bindViews();
          initState();
  
          mSlidingLayer.bringToFront();
  
          redirect();
  
  
          googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
              @Override
              public boolean onMarkerClick(Marker marker) {
  
                  marker.showInfoWindow();
                  String title = marker.getTitle();
  
                  fragNosaukums.setText(title);
                  mSlidingLayer.openLayer(true);
  
                  return true;
              }
          });
  
  
  
      }
  
  
      @Override
      public void onNavigationDrawerItemSelected(int position) {
          // update the main content by replacing fragments
          FragmentManager fragmentManager = getSupportFragmentManager();
          fragmentManager.beginTransaction()
                  .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
                  .commit();
      }
  
      public void onSectionAttached(int number) {
          switch (number) {
              case 1:
                  mTitle = getString(R.string.title_section1);
                  break;
              case 2:
                  mTitle = getString(R.string.title_section2);
                  break;
              case 3:
                  mTitle = getString(R.string.title_section3);
                  break;
          }
      }
  
      public void restoreActionBar() {
          ActionBar actionBar = getSupportActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
          actionBar.setDisplayShowTitleEnabled(true);
          actionBar.setTitle(mTitle);
      }
  
  
      public static class PlaceholderFragment extends Fragment {
          /**
           * The fragment argument representing the section number for this
           * fragment.
           */
          private static final String ARG_SECTION_NUMBER = &quot;section_number&quot;;
  
          /**
           * Returns a new instance of this fragment for the given section
           * number.
           */
          public static PlaceholderFragment newInstance(int sectionNumber) {
              PlaceholderFragment fragment = new PlaceholderFragment();
              Bundle args = new Bundle();
              args.putInt(ARG_SECTION_NUMBER, sectionNumber);
              fragment.setArguments(args);
              return fragment;
          }
  
          public PlaceholderFragment() {
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_main, container, false);
              return rootView;
          }
  
          @Override
          public void onAttach(Activity activity) {
              super.onAttach(activity);
              ((MainActivity) activity).onSectionAttached(
                      getArguments().getInt(ARG_SECTION_NUMBER));
          }
      }
  
  
  
  
  
  
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.menu, menu);
  
          return true;
      }
  
      @SuppressLint(&quot;NewApi&quot;)
      @Override
      protected void onResume() {
          super.onResume();
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
              getActionBar().setDisplayHomeAsUpEnabled(true);
  
          }
      }
  
      /**
       * View binding
       */
      private void bindViews() {
          mSlidingLayer = (SlidingLayer) findViewById(R.id.slidingLayer1);
  //        swipeText = (TextView) findViewById(R.id.swipeText);
      }
  
      /**
       * Initializes the origin state of the layer
       */
      private void initState() {
  
          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  
          setupSlidingLayerPosition(prefs.getString(&quot;layer_location&quot;, &quot;right&quot;));
  
          setupShadow(prefs.getBoolean(&quot;layer_has_shadow&quot;, false));
          setupLayerOffset(prefs.getBoolean(&quot;layer_has_offset&quot;, false));
          setupPreviewMode(prefs.getBoolean(&quot;preview_mode_enabled&quot;, false));
      }
  
      private void setupSlidingLayerPosition(String layerPosition) {
  
          DrawerLayout.LayoutParams rlp = (DrawerLayout.LayoutParams) mSlidingLayer.getLayoutParams();
          int textResource;
          Drawable d;
  
  //        if (layerPosition.equals(&quot;right&quot;)) {
              textResource = R.string.swipe_right_label;
              d = getResources().getDrawable(R.drawable.container_rocket_right);
  
              mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_RIGHT);
  
  
          d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
  //        swipeText.setCompoundDrawables(null, d, null, null);
  //        swipeText.setText(getResources().getString(textResource));
          mSlidingLayer.setLayoutParams(rlp);
      }
  
      private void setupShadow(boolean enabled) {
          if (enabled) {
              mSlidingLayer.setShadowSizeRes(R.dimen.shadow_size);
              mSlidingLayer.setShadowDrawable(R.drawable.sidebar_shadow);
          } else {
              mSlidingLayer.setShadowSize(0);
              mSlidingLayer.setShadowDrawable(null);
          }
      }
  
      private void setupLayerOffset(boolean enabled) {
          int offsetDistance = enabled ? getResources().getDimensionPixelOffset(R.dimen.offset_distance) : 0;
          mSlidingLayer.setOffsetDistance(offsetDistance);
      }
  
      private void setupPreviewMode(boolean enabled) {
          int previewOffset = enabled ? getResources().getDimensionPixelOffset(R.dimen.preview_offset_distance) : -1;
          mSlidingLayer.setPreviewOffsetDistance(previewOffset);
      }
  
      public void buttonClicked(View v) {
          switch (v.getId()) {
  //        case R.id.buttonOpen:
  //            mSlidingLayer.openLayer(true);
  //            break;
  //        case R.id.buttonClose:
  //            mSlidingLayer.closeLayer(true);
  //            break;
          }
      }
  
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          switch (keyCode) {
          case KeyEvent.KEYCODE_BACK:
              if (mSlidingLayer.isOpened()) {
                  mSlidingLayer.closeLayer(true);
                  return true;
              }
  
          default:
              return super.onKeyDown(keyCode, event);
          }
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
  
  
              case R.id.addNewEvent:
  
                  Intent intent = new Intent(this, AddEvent.class);
                  startActivity(intent);
                  ;
  
              case android.R.id.home:
                  //Do stuff
                  //mDrawerLayout.openDrawer(Gravity.LEFT);
                  return true;
          }
  
  
          return true;
      }
  
  
  
  }
  </code></pre>
  <p>And this is the error I get when i run the app.</p>
  <h1>LogCat</h1>
  <pre><code>04-18 17:39:13.878: E/AndroidRuntime(6607): FATAL EXCEPTION: main
  04-18 17:39:13.878: E/AndroidRuntime(6607): Process: com.wunderlist.slidinglayersample, PID: 6607
  04-18 17:39:13.878: E/AndroidRuntime(6607): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wunderlist.slidinglayersample/com.wunderlist.slidinglayersample.MainActivity}: java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread.access$800(ActivityThread.java:144)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.os.Handler.dispatchMessage(Handler.java:102)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.os.Looper.loop(Looper.java:135)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread.main(ActivityThread.java:5221)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at java.lang.reflect.Method.invoke(Native Method)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at java.lang.reflect.Method.invoke(Method.java:372)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  04-18 17:39:13.878: E/AndroidRuntime(6607): Caused by: java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.support.v4.widget.DrawerLayout.isDrawerView(DrawerLayout.java:1126)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.support.v4.widget.DrawerLayout.closeDrawer(DrawerLayout.java:1331)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at com.wunderlist.slidinglayersample.MainActivity.onCreate(MainActivity.java:85)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.Activity.performCreate(Activity.java:5937)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  04-18 17:39:13.878: E/AndroidRuntime(6607):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
  </code></pre>
  <p>It haven't really faced this problem before. I tried to change RelativeLayout and DrawerLayout with places but it didn't work. I guess the problem might be in java file. Does anyone have any idea how to fix this problem?</p>