Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android scrollView max scroll

Is there a way to add a range of scrolling to a scrollView? I've done a screen where user can drag views and I want to limit the possibility of dragging them down to some coordinates and modify those coordinates at runtime according to the number of object from view.

like image 247
Buda Gavril Avatar asked Feb 16 '26 17:02

Buda Gavril


1 Answers

You can use some code like this:

if(scrollView.scrollY() >= limit)
scrollView.setOnTouchListener(null);

To disable scrolling if user tries to scroll further than limit that you decided.

Edit: here, limit is coordinates typed int

like image 182
yahya Avatar answered Feb 18 '26 07:02

yahya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!