title: Closing DrawerLayout causes exception : LinearLayout cannot be cast to DrawerLayout
body: <p>I'm trying to have a custom DrawerLayout that contains a ListView but I can't get it working. I was able to make it work before I wrap the content of a LinearLayout to be able to make it more custom and add an Image above the ListView.  </p>
  
  <p>I keep having this exception when i try to closeDrawer() while passing the linearLayout, I've seen multiple post about that kind of issue but the fix for most of them is to pass the LinearLayout to the closeDrawer() function, which I already did: </p>
  
  <pre><code>04-05 12:17:10.100 18879-18879/com.plante.android.cobalt E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.plante.android.cobalt, PID: 18879
   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.plante.android.cobalt/com.plante.android.cobalt.activityv2.ActivityHome}: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
       at android.support.v4.widget.DrawerLayout.isDrawerView(DrawerLayout.java:1415)
       at android.support.v4.widget.DrawerLayout.closeDrawer(DrawerLayout.java:1630)
       at com.plante.android.cobalt.activityv2.ActivityHome.selectItem(ActivityHome.java:190)
       at com.plante.android.cobalt.activityv2.ActivityHome.onCreate(ActivityHome.java:155)
       at android.app.Activity.performCreate(Activity.java:6251)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
       at android.app.ActivityThread.-wrap11(ActivityThread.java) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:148) 
       at android.app.ActivityThread.main(ActivityThread.java:5417) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
  </code></pre>
  
  <p>Here is my activity:</p>
  
  <pre><code>@Bind(R.id.drawer_layout)
  DrawerLayout mDrawerLayout;
  @Bind(R.id.actionToolbar)
  Toolbar toolbar;
  @Bind(R.id.left_drawer_item)
  LinearLayout mDrawerLinear;
  @Bind(R.id.left_drawer_child)
  ListView mDrawerListChild;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_v2_home);
      ButterKnife.bind(this);
  
      setSupportActionBar(toolbar);
      getSupportActionBar().setTitle(getResources().getString(R.string.app_name));
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setHomeButtonEnabled(true);
  
      mPlanTitles = getResources().getStringArray(R.array.plan_list);
  
      mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
      // set up the drawer's list view with items and click listener
      ArrayList&lt;String&gt; myList = new ArrayList&lt;&gt;();
      myList.add("First Item");
      myList.add("Second Item");
      mDrawerListChild.setAdapter(new DrawerListAdapter(this, R.layout.drawer_layout_item, myList));
      mDrawerListChild.setOnItemClickListener(new DrawerItemClickListener());
  
      // enable ActionBar app icon to behave as action to toggle nav drawer
  
      mDrawerToggle = new ActionBarDrawerToggle(
              this,                  /* host Activity */
              mDrawerLayout,         /* DrawerLayout object */
              toolbar,  /* nav drawer image to replace 'Up' caret */
              R.string.drawer_open,  /* "open drawer" description for accessibility */
              R.string.drawer_close  /* "close drawer" description for accessibility */
      ) {
          public void onDrawerClosed(View view) {
              //syncActionBarArrowState();
          }
  
          public void onDrawerOpened(View drawerView) {
              //mDrawerToggle.setDrawerIndicatorEnabled(true);
          }
      };
      getSupportFragmentManager().addOnBackStackChangedListener(mOnBackStackChangedListener);
      mDrawerLayout.setDrawerListener(mDrawerToggle);
      setSupportActionBar(toolbar);
      user = getUser();
  
      if (savedInstanceState == null) {
          selectItem(0);
      }
  
  }
  
  
  private void selectItem(int position) {
      BackHandledFragment fragment = new FragmentMobilePlan();
      setSelectedFragment(fragment);
  
      FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
      ft.setCustomAnimations(R.anim.pull_in_right, R.anim.push_out_left, R.anim.pull_in_left, R.anim.push_out_right);
      ft.replace(R.id.content_frame, fragment)
              .commit();
  
      // update selected item and title, then close the drawer
      mDrawerListChild.setItemChecked(position, true);
      setTitle(mPlanTitles[position]);
      mDrawerLayout.closeDrawer(mDrawerLinear);
  }
  </code></pre>
  
  <p>Here is my layout : </p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="center"
          android:orientation="vertical"&gt;
  
          &lt;include layout="@layout/action_bar" /&gt;
  
          &lt;FrameLayout
              android:id="@+id/content_frame"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
          &lt;LinearLayout
              android:id="@+id/left_drawer_item"
              android:layout_width="200dp"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              android:orientation="vertical"&gt;
  
              &lt;ImageView
                  android:id="@+id/profilIcon"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:src="@drawable/ic_people1blue2x" /&gt;
  
              &lt;ListView
                  android:id="@+id/left_drawer_child"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:choiceMode="singleChoice"
                  android:divider="@android:color/transparent"
                  android:dividerHeight="0dp"
                  android:background="#111" /&gt;
  
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>