Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to scroll horizontal scroll view without animation

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);
    }
});
like image 443
user1116209 Avatar asked Jun 26 '12 14:06

user1116209


People also ask

What is scroll view layout?

In Android, a ScrollView is a view group that is used to make vertically scrollable views. A scroll view contains a single direct child only. In order to place multiple views in the scroll view, one needs to make a view group(like LinearLayout) as a direct child and then we can define many views inside it.


1 Answers

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);
like image 167
Girish Nair Avatar answered Nov 15 '22 13:11

Girish Nair