offsetLeftAndRight()与offsetTopAndBottom()
view.offsetLeftAndRight(offsetX);
view.offsetTopAndBottom(offsetY);
scrollTo与scrollBy
//这个方法只能移动view的内容,不包括背景
view.scrollBy(-offsetX, -offsetY);
Scroller
封装了scrollTo和scrollBy方法,可以实现动画的效果
属性动画
ObjectAnimator animator1 = ObjectAnimator.ofFloat(this, "translationX", offsetX);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(this, "translationY", offsetY);