Just give the listview a height of 0dip and a weight of 1.0.
On Sep 22, 2008 1:46 PM, "Mark Murphy" <[EMAIL PROTECTED]> wrote: > I have a problem to display the view (e.g. Button after the ListView > which I will bind and popu... <snip> > The list displays perfectly, however, the button at bottom never shows > up.. If I put the button... Have you tried putting a specific height on the ListView, or on the LinearLayout that contains it? > Anyone know the reason? I'm just guessing here, based on what I've run into. ListView does not play well with wrap_content, either on itself or on parent containers (e.g., your LinearLayout), since the "content" is indeterminate at layout time. It'll tend to grab whatever space is available, and tell its parents to grab whatever space is available. And, since Android takes a single pass through the layout files, the ListView will tend to slurp up all the available space before later widgets, like your button, get their shot. So you wind up needing "explicit" height control, such as a specific pixel height on the ListView or one of its parents. I haven't played with android:layout_weight in this scenario, to see if it could be used to better manage the ListView's height. But that might work. Or, you can always calculate the height yourself in onCreate() and adjust it as needed, if your attempts to constrain it leave you with improper dimensions on some device resolutions. Or, just have your ListView be the last widget in the chain (e.g., put the button above it). Or, dump the other widgets and just have the ListView, using dialogs or secondary activities or ViewFlipper or tabs or something for the other user input. I'm actually not a big fan of mixing ListViews and much else on an activity, mostly because we're going to wind up with some mighty small screens (e.g., 240x320 on a flip-phone-sized display), and non-touch-screen devices to boot, and so the more complicated we make our UIs, the more difficult they will be for many users to use. They might be...ummm...dreamy in the immediate term, but they'll pose problems over time as Android gets used in many other form factors. A fine example of this philosophy is the preferences activity. Everything is either something trivial for a single row (e.g., checkbox) or goes into a dialog. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.2 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are s... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

