我已经实现了一个侦听器类来检测链接
https://gist.github.com/marteinn/9427072的滚动视图结束
public class ResponsiveScrollView extends ScrollView { private OnBottomReachedListener listener; public ResponsiveScrollView(Context context) { super(context); } @Override protected void onScrollChanged(int l,int t,int oldl,int oldt) { View view = getChildAt(getChildCount()-1); int diff = view.getBottom()-(getHeight()+getScrollY()); if (diff == 0 && listener!= null) { listener.onBottomReached(this); } super.onScrollChanged(l,t,oldl,oldt); } public OnBottomReachedListener getBottomChangedListener() { return listener; } public void setBottomReachesListener(OnBottomReachedListener onBottomReachedListener) { this.listener = onBottomReachedListener; } public interface OnBottomReachedListener { public void onBottomReached(View view); } }
监听器设置为scrollView:
scrollView.setBottomReachesListener(new GenericScrollListerner(this));
我的GenericScrollListerner类:
public class GenericScrollListerner implements ResponsiveScrollView.OnBottomReachedListener { private Context mContext; public GenericScrollListerner(Context context) { this.mContext = context; } @Override public void onBottomReached(View view) { Log.d("ScrollView","Scroll end"); String tag = (String) view.getTag(); Toast.makeText(mContext,"Scroll end with tag" +tag,Toast.LENGTH_SHORT).show(); }
}
我的问题是onBottomReached在大多数情况下都会触发两次.如何处理这个问题???
解决方法
504 Gateway Time-out
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。