Hi, I'm working on a UI that involves a ListView and a search bar. Ideally, I would like the list and the search bar to be in one large scrolling area. Adding the search bar as a header works, apart from one requirement: it doesn't allow me to reliably hide and show the header on demand (I'd like the search bar to disappear when a search is started, and reappear if a search button is pressed). I've tried setting visibility on the View that contains the header to View.GONE, that does hide the header, but... it leaves a large white gap where the header used to be and I couldn't find any means of making the ListView recalculate this apart from destroying it and recreating it. Separating the search bar and the ListView results in the searchbar not scrolling along with the list, and obviously I can't use a ScrollView with the ListView.
At this point I'm working on a custom adapter extending ArrayListAdapter, with the first object being the search header, followed by the rest of the objects, but inflating different kinds of view rows doesn't seem to work too nicely, not to mention the header becomes a "regular" ListView item which means I have to manually disable all sorts of behaviour that a regular item is supposed to have but a header isn't.. Another option I'm considering is to abandon the ListView altogether and manually build up the list (in a ScrollView / other kind of scrollable layout) but that's of course fairly ugly and has possible maintenance implications, besides it being at least a partial reinvention of the wheel. I'm posting this to see if anyone has a suggestion for a somewhat less messy approach for this. For now I'm bound to the 1.5 version of the SDK. -- 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

