Mathan Chinna
Mathan Chinna

Reputation: 597

How to get NestedScrollView state like start scrolling and stop scrolling?

When I am using CoordinatorLayout, I just want to nested scroll view state or please give me an suggestion for how to suddenly stop scrolling..

Because I am using scrollTo() function it's not working properly, when override the scrolling. So I want to stop previous scrolling then call scrollTo() function.

My code is :

  scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.scrollTo(0, contentHeadingView.getTop());
        }
    });

And any idea to get NestedScrollView scrolling action is stopped and NestedScrollView scrolling action is start. It will more help full for me.

Please help me.

I hope you someone to give me a solution.

Thanks.

Upvotes: 1

Views: 1583

Answers (2)

devjava20
devjava20

Reputation: 3

To stop scrolling you need to use this method nestedScrollView.stopNestedScroll(); and then to start scrolling to certain position use this method nestedScrollView.scrollTo(0,0); If you want to start scroll after sometime, you can use this inside handler. Hope this works!

Upvotes: 0

kalabalik
kalabalik

Reputation: 3832

To stop scrolling simply use scrollView.smoothScrollBy(0, 0);

Upvotes: 2

Related Questions