Nikki
Nikki

Reputation: 3318

How to perform automatic scrolling?

I am using scroller class for auto scroll of the text in edittext but after stopping the animation scrolling goes back to top of the text and i want it to stop at current position. How can i perform this task? I am using this code for scrolling:

public void Scroll()
       {
        scroll = new Scroller(PromptModeActivity.this,new LinearInterpolator());
        length = prompt_text.getLineCount();
        scroll.computeScrollOffset();
        prompt_text.setScroller(scroll);
        int a=prompt_text.getBottom();
        scroll.extendDuration(scroll.getFinalY());
            scroll.startScroll(scroll_x,scroll_y,0,a+500,
                (400000)/ speedAmount); 

       }

and using scroll.abortAnimation() to stop scrolling. Thanks in advance.

Upvotes: 2

Views: 3751

Answers (1)

EboMike
EboMike

Reputation: 77732

An animation is not what you want here. Instead, I believe you're looking for ScrollView.pageScroll().

Upvotes: 2

Related Questions