Friday, September 16, 2011

Re: [android-developers] widgets not showing up after ListView

On Fri, Sep 16, 2011 at 3:47 PM, John Goche <johngoche99@googlemail.com> wrote:
<!-- ListView (grid_items) -->
  <LinearLayout android:id="@+id/layout"
    android:layout_width="wrap_content" android:layout_height="fill_parent">
    <ListView android:layout_weight="1" android:id="@+id/listview"
      android:layout_width="fill_parent" android:layout_height="fill_parent"></ListView>
  </LinearLayout>

A) If you tell the "layout" LinearLayout to fill it's parent vertically, it will do exactly that, pushing the rest out of the way.
B) Putting a ListView inside a LinearLayout for no other reason than to contain it is redundant and wasteful.

Remove the "layout" LinearLayout and set the ListView's height to wrap_content, leaving it's weight to 1 so it takes all available space after the other items are laid out.

Also have a looky-loo at ListView setFooterView() and setHeaderView() - might make sense in your scenario.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment