The goal is to implement a Gallery whose adapter returns ListViews (in
other words, vertically scrolling ListViews embedded in a horizontally
scrolling Gallery). It sort of works after a bit of work, but when
attempting to scroll horizontally, the ListView looks very jittery,
like there is some stickiness to it being centered.  To be more clear,
when you attempt to scroll horizontally, the ListView scrolls smoothly
for a few pixels and then as you continue scrolling it starts to jump
back and forth from its original position to the current position
rapidly.

I have not observed this kind of behavior with any other type of View
embedded in a Gallery.

Initially, I found that the ListView squashed touch events, so the
gesture listener on the Gallery never gets fired.

So in the onCreate() method of the Activity, I created a
GestureDetector:

galleryGestureDetector = new GestureDetector(this, gallery);

Then, inside the getView() method of the Gallery adapter, after the
ListView has been inflated and configured, I have some code like this:

listView.setOnTouchListener(new OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        galleryGestureDetector.onTouchEvent(event);
        return true; /* temporarily prevent onTouchEvent() from being
fired on the ListView */
    }
});

In this case I have even gone to the extreme step of returning true
from the OnTouchListener to ensure that the onTouchEvent() method of
the listView is never actually called. The same jittery behavior
occurs. As a result, I think I can rule out competing onTouchEvent()
implementations between the two views.

I tried abusing the TouchDelegate concept as well by extending the
Gallery's touch rectangle to include the ListView and then forcing the
ListView to delegate to it, but this was a futile effort as well.

When I asked elsewhere, the suggestion was made that the Gallery was
inflating the ListViews over and over again as you scrolled, so in an
attempt to test if this was the issue, I created a temporary cache of
the ListViews by adapter position, and verified that only 3 ListViews
are ever inflated (correlating with the 3 adapter positions I have in
my test case).

I would throw up my hands and say it isn't possible currently, but the
Social Networking app that packs with the DroidX somehow accomplishes
it!

-- 
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

Reply via email to