10

The problem is that I'm using the fullScroll() and scrollTo() functions to scroll but it is animated and I need it happen without user observation.

Is there a way to solve this problem?

hScrollView.post(new Runnable() {
    @Override
    public void run() {
        hScrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
    }
});
3
  • try hScrollView.fullScroll(ScrollView.FOCUS_LEFT); Commented Jun 26, 2012 at 14:58
  • thanks, but I tried it before and I have the same problem! Commented Jun 26, 2012 at 15:03
  • But what's wrong with animation? I would think the user experience is better if they see the scrolling rather than just a jump to another location. Commented Jun 26, 2012 at 15:08

2 Answers 2

7

Use this

// Disable the animation First
hScrollView.setSmoothScrollingEnabled(false);
// Now scroll the view
hScrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
// Now enable the animation again if needed
hScrollView.setSmoothScrollingEnabled(true);
Sign up to request clarification or add additional context in comments.

Comments

1

You can use hScrollView.setSmoothScrollingEnabled(false); before running the Runnable command, this will give you the desired output

        // Set smooth scrolling to false
        hScrollView.setSmoothScrollingEnabled(false);

        // Then call the fullScroll method
        hScrollView.post(new Runnable() {
            @Override
            public void run() {
                hScrollView.fullScroll(View.FOCUS_RIGHT);
            }
        });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.