title: List View above Linear Layout
body: <p>I'm trying to place a linear Layout below a List View in XML and for some reason I get this error</p>
  
  <p>android.widget.ImageButton cannot be cast to android.widget.ListView</p>
  
  <p>at com.yonivy. ... .onCreate ... .java:37</p>
  
  <p>Here's the xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
  &lt;ListView
      android:id="@+id/mList"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:divider="@android:color/transparent"
      android:dividerHeight="1.0sp"
      android:padding="10dp" &gt;
  &lt;/ListView&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="10dp"
      android:divider="?android:attr/dividerVertical"
      android:orientation="horizontal"
      android:showDividers="middle" &gt;
  
      &lt;ImageButton
          android:id="@+id/addBtn"
          android:layout_width="0dip"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:background="@android:color/transparent"
          android:src="@drawable/content_new" /&gt;
  
      &lt;ImageButton
          android:id="@+id/editBtn"
          android:layout_width="0dip"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:background="@android:color/transparent"
          android:src="@drawable/content_edit" /&gt;
  
      &lt;ImageButton
          android:id="@+id/deleteBtn"
          android:layout_width="0dip"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:background="@android:color/transparent"
          android:src="@drawable/navigation_cancel" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here's the onCreate</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.category_activities);
  
      lv = (ListView) findViewById(R.id.mList); // line 37
  
      // ...
  
  }
  </code></pre>
  
  <p>If i place the List View as the last child everything works fine for some reason, but that's not how I want it.</p>