Mazka
Mazka

Reputation: 349

Disable scrolling on a Scrollview

I need to disable the scroll/drag functionality on a Scrollview for a brief time. I've been playing around changing a couple of options on the Scrollview, but none seem to disable it completely.

Upvotes: 1

Views: 200

Answers (1)

Joseph
Joseph

Reputation: 539

There is no official way to stop the scroll without unpiping the listeners (something I would not recommend). The easiest way to stop the scroll is to prematurely end the scroll.

When you create your surfaces for the Scrollview pipe an additional update listener. Within the handler, whenever you want to prematurely stop the scroll do this:

this._scrollview._earlyEnd = true;

The _earlyEnd is an internal variable used by the Scrollview, once set it will disable all scrolling for that touch event. _earlyEnd is reset during the start and end events so setting it before the start event will not do you any good. The only reliable place to set the flag is during the touch/scroll move (update's).

Upvotes: 1

Related Questions