title: Android ListView addFooterView margin/padding issue
body: <p>I have a ListView that has a LinearLayout as its footer view that contains a TextView and a ListView initialized like so:</p>
  
  <pre><code>mylist = (ListView) findViewById(R.id.mylist);
  mylistadapter = new MyListAdapter(MainView.this, info);
  myfooterlistadapter = new MyListAdapter(MainView.this, info);
  LinearLayout footer = (LinearLayout)getLayoutInflater().inflate(R.layout.myfooter, null);
  myfooterlist = (ListView) footer.findViewById(R.id.myfooterlist);
  mylist.addFooterView(footer, null, false);
  </code></pre>
  
  <p><code>mylist</code> is declared as:</p>
  
  <pre><code>&lt;ListView
      android:id="@+id/mylist"
      android:layout_width="fill_parent"
      android:layout_height="0dip" &lt;!-- have also tried fill_parent without weight, same--&gt;
      android:layout_weight="1"
      android:layout_marginLeft="5dip"
      android:layout_marginRight="5dip"
      android:cacheColorHint="#00000000"
      android:dividerHeight="1dip"
      android:drawSelectorOnTop="false" /&gt;
  </code></pre>
  
  <p>The footer (LinearLayout is declared as):</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      android:id="@+id/myfooter" &gt;
  
      &lt;TextView
          android:id="@+id/myfooterlabel"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/headermainview"
          android:paddingLeft="2dip"
          android:text="@string/myfootertext"
          android:textColor="@color/black"
          android:textSize="16sp"
          android:textStyle="bold"
          android:visibility="gone" /&gt;
  
      &lt;ListView
          android:id="@+id/myfooterlist"
          android:layout_width="fill_parent"
          android:layout_height="0dip" &lt;!-- have also tried fill_parent without weight, same--&gt;
          android:layout_weight="1"
          android:cacheColorHint="#00000000"
          android:dividerHeight="1dip"
          android:drawSelectorOnTop="false"
          android:visibility="gone"
          android:background="@color/green" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>If my footer list has items, I change the visibility on both the TextView and the footer ListView to visible.</p>
  
  <p>Now, I painted the background green on the footer listview to see the problem (sorry for hiding the text but it's confidential information). As you can see, I keep getting some extra margin on the bottom of my footer list. I've tried changing from fill_parent to wrap_content to 0dip with weight=1 for the lists and the LinearLayout but none worked. As you can see, I don't have anything related to adding extra margin after the last item on the footer list. 
  The top list has 20 items (I've scrolled to the bottom of the screen) and my footer list has 1 item only in this case:</p>
  
  <p><img src="https://i.stack.imgur.com/kkoUx.png" alt="Extra margin on bottom of footer list"></p>
  
  <p>Any ideas what's going on and how to not have this extra margin on the bottom of my footer list? Thanks!</p>
  
  <p>UPDATE:</p>
  
  <p>After further inspection it seems that regardless of the size of the 2nd list (I added more items to see) the height stays the same (green box always the same size). I changed to fill_parent height on the LinearLayout (no weight) and the 2nd List but still the same size. Doesn't ListView dynamically compute the height of the footer to know how big to make it?</p>
  
  <p>I'm adding a new screenshot to show you more in detail that the 2nd item is cut off (the top list is not stretching to cover the entire 2nd list).</p>
  
  <p><img src="https://i.stack.imgur.com/eUpYD.png" alt="1st list doesn&#39;t stretch to fully cover 2st list"></p>
  
  <p>UPDATE 2:</p>
  
  <p>After further investigation if I set the height of my 2nd ListView (myfooterlist) to a particular height (say 300dip) then the 1st list shows the whole 2nd list when I scroll to the bottom. If I set it to fill_parent or wrap_conent or 0dp and add layout_weight=1 then it gives me the same height as the image above for all of them. Any idea what's going on with computing the height dynamically?</p>