Scaling would be a combination of both translations and scale:
// zooms in to the center of the screen mZoomIn = new AnimationSet(true); mTranslate = new TranslateAnimation( Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, -imageViewXCoord/(mScreenWidth/mImageViewWidth), Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, -imageViewYCoord/(mScreenWidth/mImageViewWidth) ); mTranslate.setDuration(200); mScale = new ScaleAnimation(1, mScreenWidth/mImageViewWidth, 1, mScreenWidth/mImageViewWidth); mScale.setDuration(200); mZoomIn.addAnimation(mTranslate); mZoomIn.addAnimation(mScale); mZoomIn.setFillAfter(true); mZoomIn.setFillEnabled(true); mImageView.startAnimation(mZoomIn);
When scaling, the inverse interpolator will be used when scaling, after which you can call startAnimation on your image in accordance with the normal one:
mZoomIn.setInterpolator(new ReverseInterpolator())
source share