How can I get another view from one view using the zoom animation? The problem is that I have two views, one is smaller in size, the second is larger, it is necessary for the second to smoothly transfer to the first. I did this with the help of animation, but the problem is that when I increase the view to the desired size, the view then shifts to the left, I think the problem is in the animation settings. Here is the code with which I created the animation.

animZoom = new ScaleAnimation(1, 0.95f, 1, 1.15f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animZoom.initialize(firstView.getWidth(), firstView.getHeight(), getWidth(), getHeight()); animZoom.setDuration(5500); 
  • four
    You need to describe the issue in more detail. - Shwarz Andrei
  • I dare to suggest that a person wants to do, for example, so that after increasing the ImageView, it becomes Button - BORSHEVIK

2 answers 2

 animZoom = new ScaleAnimation(1, 0.95f, 1, 1.15f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animZoom.initialize(firstView.getWidth(), firstView.getHeight(), getWidth(), getHeight()); animZoom.setDuration(5500); animZoom.setFillAfter(true); 

once solved a similar problem like this

    Thank you, but this flag does not solve the problem, because if you do the procedure again, the view decreases again. I solved the problem this way:

     animZoom = new ScaleAnimation(1,0.95f, 1, 1.15f, Animation.RELATIVE_TO_SELF, 0.01f, Animation.RELATIVE_TO_SELF, 0.5f); animZoom.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { secondView.setLayoutParams(lParamFirst); //... } @Override public void onAnimationRepeat(Animation animation) { } });