After digging a little further:

The scrolling is caused by HorizontalScrollView.onSizeChanged. The HSV
gets the currently focused item and makes sure that it is visible in
the scroll in the new size, with the following code (from the HSV
source):

  View currentFocused = findFocus();
  if (null == currentFocused || this == currentFocused) return;

  final int maxJump = mRight - mLeft;

  if (isWithinDeltaOfScreen(currentFocused, maxJump)) {
     // [Scroll the view]
  }

I don't know what View had focus according the framework, but it was
trying to scroll it into view. I'm also unclear why this was only
happening when a ListView was shown - it's possible that the ListView
declares itself focusable and the LinearLayout doesn't.

I "fixed" the issue by subclassing HorizontalScrollView to return null
from findFocus(). I'm still able to click on elements within the HSV -
I suspect that navigating the UI with a d-pad might not work.

If someone has a non-hack solution let me know...

Mike



On May 4, 10:35 am, MB <[email protected]> wrote:
> Hello,
>
> I am developing for Honeycomb, and I have aHorizontalScrollViewwith
> a number of "panels" that make up the UI. The rightmost panel changes
> its content, sometimes displaying a ListView. I also have a sliding
> drawer that, when opening or closing, causes theHorizontalScrollView
> to resize.
>
> When theHorizontalScrollViewresizes, it also jumps to show the
> rightmost panel, which I don't want. But this only happens when the
> panel contains a ListView - when the panel contains a LinearLayout 
> theHorizontalScrollViewdoesn't change it's position when resizing.
>
> The only similar issue I found while searching is 
> this:http://stackoverflow.com/questions/1878623/listview-in-a-horizontalsc...,
> but it's triggered by an adapter changing data rather than a resize.
>
> How can I stop this automatic scrolling?
>
> Thanks,
> Mike

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