开发者

android scrollView max scroll

开发者 https://www.devze.com 2023-04-02 06:50 出处:网络
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

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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消