/**
* 经测试left是child距离其父容器左边的距离(父容器的padding也算),dx是距离其初始位置的相对值,偏左为负
* 偏右为正
* 返回值是child距离父容器左边的距离范围(不能写死)
*/
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
// Log.e("aaaaaa",left+"aa"+dx);
// return 0;
final int leftBound = getPaddingLeft();
final int rightBound = getWidth() - child.getWidth() - leftBound;
final int newLeft = Math.min(Math.max(left, leftBound), rightBound);
Log.e("aaaaaa", leftBound+"aaaaaa"+rightBound+"aaaaaa"+left+"aaaaaa"+newLeft);
return newLeft;
}