Hello all,

I'm trying to achieve the following with my Android search app:

- 2 input boxes where the user can enter criteria to search for
- 1 search button
- when the search button is clicked, a search is performed and on the
same page the matches are shown *below* the 2 input boxes and search
button.
- the results can be quite a few (say up to 50), which won't fit all
on the viewable part of the screen, so the user has to be able to
scroll down in the results.
- when the user scrolls down over the results, the 2 input boxes +
search button should of course also scroll up out of sight.

Basically the behaviour you get when you for example do a google
search on google.com. But, for clarity: I don't want to use the
WebView.

Note that there should be no scrollbar for the results only (that can
be done easily with a standard ListView), the all needs to scroll as a
whole.

The reason I want this behavior is that I don't want to direct the
user to a next screen with the search results; that would be so
annoying having to go back to the "search" screen all the time if you
want to enter another search criteria, like if you figured out you
made a typo.

Now I've read most posts about possible solutions, quite a few people
asked for this before, like:

http://groups.google.com/group/android-developers/browse_thread/thread/b7d2b7c275ac730f/803f40201920c6d9?lnk=gst&q=scrollview+listview&pli=1
http://groups.google.com/group/android-developers/browse_thread/thread/3bfb013704d886fb/a556ab75f22c8dd1?lnk=gst&q=scrollview+listview
http://groups.google.com/group/android-developers/browse_thread/thread/af85d0ccddfd10d7/b4d705341719382c?lnk=gst&q=scrollview+listview
http://groups.google.com/group/android-developers/browse_thread/thread/77acd4e54120b777/00fe963ec94d78ad?lnk=gst&q=scrollview+listview
http://groups.google.com/group/android-developers/browse_thread/thread/a05227c317c8ad8d/86e6f054fba30828?lnk=gst&q=scrollview+listview
http://groups.google.com/group/android-developers/browse_thread/thread/fd0da00fe94ffed8/1d3bd9b81dd7d3e3?lnk=gst&q=scrollview+listview

But I haven't been able to find the real solution for my requirements.
I've also not seen any apps yet that do implement anything like this,
though I haven't seen all apps.

This what I already tried on the emulator:

a) ListView inside a Scrollview. Thus:

<Scrollview>
....<EditText>
....<EditText>
....<Button>
....<ListView>
</ScrollView>

The app looks like I want it; I calculate the total height of the
ListView items and set the ListView's height to that. This way there's
no scrollbar on the ListView itself, only the Scrollview's scrollbar
shows. And I can scroll down in the ListView entries using the "down"
key.
Problems: multiple posts mention to NOT do this, scrolling gets
confused. And indeed, although the result is exactly how I want it to
look, scrolling acts up: stepping through  the entries in the list
below what's visible, scrolling of the whole  (performed by the
ScrollView) stops until the last entry is reached!
So unless I maybe make my own custom ListView that doesn't perform any
scrolling (or whatever fixes this behaviour), this solution is a dead
end. Any tips would be most welcome.

b) Fixed listviewheader in a ListView (no ScrollView) containing the 2
boxes and searchbutton, more or less like
http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/
and in the API demo "Views/Lists/8. photos". Thus:

<LinearLayout>
....<ListView>
</LinearLayout>

In the code I then set the header of the list to this separate view:
<LinearLayout>
....<EditText>
....<EditText>
....<Button>
</LinearLayout>

Problems: Firstly: the user has to scroll a lot more to see all
results because the header keeps occupying the top of the screen.
Secondly, with the emulator up-key I can't "step" (focus) onto the
Search button or input boxes anymore! If I turn on focusability for
the header, I can only "step" up onto the whole header, not the
separate fields. If I turn it off, nothing happens, I can only scroll
up to the top entry in the resultlist.
Thus this might work (though not completely matching my requirements),
but only if is it possible to make the inputboxes + searchbutton part
of the "scrolling up" focus sequence. Is this possible?

c) Inputboxes + search button separate from the ListView, having the
inputboxes + search button fixed on top, ListView below them,
scrollable (e.g. in a FrameLayout). Got this to work, but I don't want
the inputfields to be fixed, so just like  b) dismissed.


- Other solutions mentioned in posts but not tried yet:
1) use a LinearLayout per entry and attach an adapter to it, having
listeners on the adapter to reload the layout. Could this give me the
behaviour I want?
2) use tabs. Nope that's a completely different look and feel than
what I'm trying to achieve.
3) use ViewFlipper or one of its kin and create your own setup for
flipping between the list and the rest of the contents of the
ScrollView. Sounds interesting, but are there any examples of this or
a bit more pseudo code maybe on how one would do this?

So my question: has anybody implemented this in some way? Or more
detailed tips on how to implement this? Has anybody seen any apps in
the MarketStore that implement search like this? Or is there a reason
to not want an app designed like this? What would be then a better way
(best practice) of setting up a search+results app?

Regards,
Marco



--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to