title: LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
body: <p>I'm trying to do Navigation drawer options.</p>
  
  <p>Here is my xml:</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"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
          &lt;Button
               android:id="@+id/sendnewmessages"
               android:layout_width="wrap_content"
               android:layout_height="30dp"
               android:background="@drawable/nothere"
               android:gravity="center_horizontal"
               android:shadowColor="@android:color/black"
               android:shadowDx="1"
               android:shadowDy="1"
               android:shadowRadius="1"
               android:text="Send New Messages"
               android:textAlignment="center"
               android:textColor="@android:color/black" /&gt;
          &lt;EditText
               android:id="@+id/searchmessage"
               android:layout_height="40dp"
               android:layout_width="200dp"
               android:gravity="center"
               android:hint="Search Messages"/&gt;
          &lt;ListView
              android:id="@+id/listview"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"&gt;
          &lt;/ListView&gt;
          &lt;ListView android:id="@+id/left_drawer"
              android:layout_width="240dp"
              android:layout_height="match_parent"
              android:layout_gravity="start"
              android:choiceMode="singleChoice"
              android:divider="@android:color/transparent"
              android:dividerHeight="0dp"
              android:background="#111"/&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>If I remove <code>Linearlayout</code> there is no error. This button appears behind <code>listview</code>, <code>edittext</code> appears in the middle of screen. The problem is that the objects are not aligned. Is there a way align view objects in <code>DrawerLayout</code>? </p>
  
  <p>If I don't remove <code>linearlayout</code> I get this error:</p>
  
  <pre><code>LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams
  </code></pre>
  
  <p>stacktrace:</p>
  
  <blockquote>
    <blockquote>
      <p>E/AndroidRuntime(3454): FATAL EXCEPTION: main Process: com.brilliant.bridge, PID: 3454 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:910)
      at
      android.support.v4.widget.DrawerLayout.isDrawerOpen(DrawerLayout.java:1156)
      at
      com.brilliant.bridge.AdminMessages.onPrepareOptionsMenu(AdminMessages.java:220)
      at android.app.Activity.onPreparePanel(Activity.java:2556) at
      com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:464)
      at
      com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:800)
      at
      com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:221)
      at
      android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
      at android.view.Choreographer.doCallbacks(Choreographer.java:574) at
      android.view.Choreographer.doFrame(Choreographer.java:543) at
      android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
      at android.os.Handler.handleCallback(Handler.java:733) at
      android.os.Handler.dispatchMessage(Handler.java:95) at
      android.os.Looper.loop(Looper.java:136) at
      android.app.ActivityThread.main(ActivityThread.java:5017) at
      java.lang.reflect.Method.invokeNative(Native Method) at
      java.lang.reflect.Method.invoke(Method.java:515) at
      com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at
      dalvik.system.NativeStart.main(Native Method)</p>
    </blockquote>
  </blockquote>
  
  <pre><code>public boolean onPrepareOptionsMenu(Menu menu) {
  
      boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
      menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
      return super.onPrepareOptionsMenu(menu);
  }
  </code></pre>