content: package com.mahao.alex.systemwidgetdemo.listView;
  
  import android.content.Context;
  import android.util.AttributeSet;
  import android.util.DisplayMetrics;
  import android.widget.ListView;
  
  /**
   * Created by Alex_MaHao on 2016/5/17.
   */
  public class MyListView extends ListView {
  
      /**
       * 下拉回弹效果，下拉的最大距离
       */
      private int mMaxOverDistance;
  
      public MyListView(Context context) {
          super(context);
      }
  
      public MyListView(Context context, AttributeSet attrs) {
          super(context, attrs);
  
          //初始化最大距离
          DisplayMetrics metrics = context.getResources().getDisplayMetrics();
          float density = metrics.density;
          mMaxOverDistance = (int) (100*density);
      }
  
      public MyListView(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
      }
  
      @Override
      protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
  
          //注意第九个参数，设置为了我们自定义的值
          return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, mMaxOverDistance, isTouchEvent);
      }
  }
  