title: Android: XML Layout problems
body: <p>I've been trying to create a RelativeLayout with a header, body (list) and footer.
  I want the header to be above everything (aligned to top), the body (list) to be under the header (when scrolling) and the footer (aligned to bottom) to be above the body (list) - only when it's visible.</p>
  
  <p>I've managed to do so PERFECTLY when it comes to how things look but apparently the XML layout is the cause to the issues I've been having when clicking on listItems (<a href="https://stackoverflow.com/questions/4010623/android-click-on-listitem-checks-wrong-checkbox">see here</a>, <a href="https://stackoverflow.com/questions/4019308/android-list-getcheckeditempositions-always-returns-null">and here</a>).</p>
  
  <p>In order to solve the issues, I had to wrap the ListView with LinearLayout and put it between the header and the footer (in the XML).
  This solves the listItems clicking issues BUT creates a new issue - the footer hides the last ListView item, even though the list does go under the header when scrolling it down.</p>
  
  <p>I'm pretty much desperate here :\</p>
  
  <p><strong>This is the XML which creates the perfect layout but causes the List Item clicking issues:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:background="#ffffff"
      &gt;
      &lt;RelativeLayout
          android:background="@drawable/top_background"
          android:layout_width="fill_parent"
          android:layout_height="50dip"
          android:id="@+id/top_control_bar"
          &gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:text="Droidmarks"
              android:layout_alignParentLeft="true"
              android:layout_toLeftOf="@+id/add_bookmark"
              android:textSize="20dip"
              android:textColor="#a0cb26"
              android:shadowColor="#7a9b1b"
              android:shadowRadius="5"
              android:layout_marginLeft="5dip"
              android:gravity="left|center" /&gt;
          &lt;Button
              android:id="@+id/add_bookmark"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right|center"
              android:layout_alignParentRight="true"
              android:text="Add"
          /&gt;
      &lt;/RelativeLayout&gt;
      &lt;LinearLayout
          android:id="@+id/bottom_control_bar"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@drawable/top_background"
          android:visibility="invisible"
          &gt;
          &lt;Button
              android:id="@+id/test"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right|center"
              android:layout_alignParentRight="true"
              android:text="Add"
          /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;ListView
          android:id="@android:id/list"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/top_control_bar"
          android:layout_above="@id/bottom_control_bar"
          android:drawSelectorOnTop="false"
          android:focusable="false"
          android:focusableInTouchMode="false"
          android:cacheColorHint="#ffffff"
          android:listSelector="@drawable/selected_item"
          /&gt;
      &lt;TextView android:id="@android:id/empty" android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="No Bookmarks found. You can add one by clicking the star."
          android:layout_below="@id/top_control_bar" android:layout_above="@id/bottom_control_bar" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>This is the XML which hide the last List Item but solves the clicking issues:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:background="#ffffff"
      &gt;
      &lt;RelativeLayout
          android:background="@drawable/top_background"
          android:layout_width="fill_parent"
          android:layout_height="50dip"
          android:id="@+id/top_control_bar"
          android:layout_alignParentTop="true"
          &gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:text="Droidmarks"
              android:layout_alignParentLeft="true"
              android:layout_toLeftOf="@+id/add_bookmark"
              android:textSize="20dip"
              android:textColor="#a0cb26"
              android:shadowColor="#7a9b1b"
              android:shadowRadius="5"
              android:layout_marginLeft="5dip"
              android:gravity="left|center" /&gt;
          &lt;Button
              android:id="@+id/add_bookmark"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="right|center"
              android:layout_alignParentRight="true"
              android:text="Add"
          /&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/listArea"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:layout_below="@id/top_control_bar"
          &gt;
          &lt;ListView
              android:id="@android:id/list"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:drawSelectorOnTop="false"
              android:cacheColorHint="#ffffff" /&gt;
          &lt;TextView android:id="@android:id/empty" android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="No Bookmarks found. You can add one by clicking the star." /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/bottom_control_bar"
          android:layout_above="@id/listArea"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@drawable/top_background"
          android:orientation="horizontal"
          android:visibility="visible"
          &gt;
          &lt;Button
          android:id="@+id/test"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="right|center"
          android:layout_alignParentRight="true"
          android:text="Add"
      /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I'd appreciate any help to somehow find a solution for both issues!</p>
  
  <p>Thank you!</p>