HorizontalScrollView:

    @Override    protected void onScrollChanged(int l, int t, int oldl, int oldt) {    // TODO Auto-generated method stub    super.onScrollChanged(l, t, oldl, oldt);    int  maxScrollX = getChildAt(0).getMeasuredWidth()-getMeasuredWidth();         //滑到最左        if (getScrollX() == 0 ) {                 }else if (getScrollX() == maxScrollX) {  //滑到最右        }else {  //滑到中间}    }


ScrollView:

只需将上面代码中的ScrollX改为ScrollY,MeasuredWidth改为MeasuredHeight即可




参考http://stackoverflow.com/questions/9597943/how-to-detect-that-the-horizontalscrollview-has-reached-an-end

更多相关文章

  1. android 100行代码实现 仿苹果滑动选择器WheelView
  2. Android之图文混排 (二)源代码
  3. 一段Android实现应用下载并自动安装apk包的代码
  4. 36个Android开发常用代码片段
  5. Android 进阶的小技巧整理(整理自第一行代码)
  6. Android 通过代码设置着色图片
  7. android典型代码系列(五)------deviceadmin步骤
  8. 用代码如何检测一个android程序是否在运行

随机推荐

  1. [Android] 更改关联的源码路径
  2. Android手机开发:开机自动启动程序
  3. 如何在Android中在fragment中实现点击按
  4. Android EventBus 传递消息
  5. Android 将Button设置为圆角
  6. Android 图片压缩
  7. android 进度对话框的使用
  8. BroadcastReceiver广播监听android网络状
  9. Introduction to Android Power Manageme
  10. Android中自定义View支持缩放