获取View位置
- getTop():获取View自身顶边到其父布局顶边的距离
- getLeft():获取View自身左边到其父布局左边的距离
- getRight():获取View自身右边到其父布局右边的距离
- getBottom():获取View自身底边到其父布局底边的距离
View的滑动
可通过属性动画实现View的滑动
//组合动画——AnimatorSet
//scrollView父布局,cdDetail子布局
ObjectAnimator x = ObjectAnimator.ofInt(scrollView,"scrollX",0);
ObjectAnimator y = ObjectAnimator.ofInt(scrollView,"scrollY",cdDetail.getTop());
AnimatorSet animatorSet = new AnimatorSet();
//设置时长
animatorSet.setDuration(500L);
animatorSet.play(y);
//animatorSet.playTogether(x,y);
animatorSet.start();