【发布时间】:2018-12-17 05:18:52
【问题描述】:
我想在不同的回收站视图之间拖放项目,并在项目向左或向右时使水平滚动自动滚动。
这是我的代码,但它没有按预期工作
mScrollDistance = scrollView.getScrollY();
int y = Math.round(v.getX())+Math.round(event.getX());
int translatedY = y ;
Log.i("translated",""+translatedY+" "+ mScrollDistance+" "+y);
int threshold =50 ;
if (translatedY < 200) {
scrollView.smoothScrollBy(-15, 0);
}
// make a autoscrolling down due y has passed the 500 px border
if (translatedY + threshold > 500) {
scrollView.smoothScrollBy(15, 0);
}
【问题讨论】:
标签: android android-studio android-recyclerview drag-and-drop autoscroll