1. 获取View相对屏幕的坐标
int[] location = new int[2]; //left和top
detailParam.mSourceView.getLocationOnScreen(location);
ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(detailParam.mSourceView,
0, -initialOperationBarHeight,
detailParam.mThumbWidth, detailParam.mThumbHeight + initialOperationBarHeight);
ActivityCompat.startActivityForResult(detailParam.mActivity, detailParam.build(),
requestCode, options.toBundle());
即在跳转Activity的时候,可以用过ActivityOptionsCompat增加各种特效
2. setPivotX和setPivotY
我们在做一些动画效果时
缩放、反转等都有中心点或者轴,默认中心缩放,和中间对称线为反转线
如果我们想这个横向,纵向缩小以左上角为中心点:
targetView.setPivotX(0);
targetView.setPivotY(0);
targetView.invalidate(); //这个好像不用调用也可以