Note that there are some explanatory texts on larger screens.

plurals
  1. POEmbedding ListView inside Gallery
    text
    copied!<p>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. I have not observed this kind of behavior with any other type of View embedded in a Gallery.</p> <p>Here is what I have tried:</p> <p>Initially, I found that the ListView squashed touch events, so the gesture listener on the Gallery never gets fired.</p> <p>So in the onCreate() method of the Activity, I created a GestureDetector:</p> <p><code>galleryGestureDetector = new GestureDetector(this, gallery);</code></p> <p>Then, inside the getView() method of the Gallery adapter, after the ListView has been inflated and configured, I have some code like this:</p> <pre><code>listView.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { galleryGestureDetector.onTouchEvent(event); return true; } }); </code></pre> <p>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.</p> <p>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.</p> <p>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!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload