简体   繁体   English

Android滚动查看最大滚动

[英]android scrollView max scroll

Is there a way to add a range of scrolling to a scrollView? 有没有一种方法可以将滚动范围添加到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 编辑:这里,极限是输入int的坐标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM