I'm creating an android application. Now i want to open a new activity with zooming transition im using the following codes to acheive that but its not working.
private void centerAndZoomView( View view)
{
LinearLayout root = (LinearLayout) findViewById( R.id.top_root );
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics( dm );
int statusBarOffset = dm.heightPixels - root.getMeasuredHeight();
int originalPos[] = new int[2];
view.getLocationOnScreen( originalPos );
int xDest = dm.widthPixels/2;
xDest -= (view.getMeasuredWidth()/2);
int yDest = dm.heightPixels/2 - (view.getMeasuredHeight()/2) - statusBarOffset;
TranslateAnimation anim = new TranslateAnimation( 0, xDest - originalPos[0] , 0, yDest - originalPos[1] );
Animation scale
= new ScaleAnimation(1.0f,root.getMeasuredWidth()/view.getMeasuredWidth() , 1.0f, root.getMeasuredHeight()/view.getMeasuredHeight(),
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
scale.setInterpolator(new AccelerateInterpolator());
AnimationSet set = new AnimationSet(true);
set.addAnimation(anim);
set.addAnimation(scale);
set.setFillAfter(false);
set.setDuration(7000);
set.start();
view.startAnimation(set);
set.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationStart(Animation animation){}
@Override
public void onAnimationRepeat(Animation animation){}
@Override
public void onAnimationEnd(Animation animation)
{
callIntent();
}
});
}
Basically I want the effect that the new activity with zooming effect. But for now my current clicked button only zooming. How can I achieve that? please help me to solve this.