0

I wanted to animate view as shown in the image. How to do it?
Click here to see the image
I have the following code but how to set the parameter current?

How Animation works?
When the user moves his finger over the list of icons, the height of the current icon, where the user has touched, is set to 400.

TransitionManager.beginDelayedTransition(layout);
View child = layout.getChildAt(current);
child.setMinimumHeight(400);

where current is of type int.

Kavin Raju S
  • 1,214
  • 2
  • 17
  • 25

1 Answers1

0

Shouldn't try to change a View height, margin or padding if you want to do an animation.

Do a scale animation instead on focus:

View child = layout.getChildAt(current);
child.animate().scaleX(2f).scaleY(2f).setDuration(400).start();

Scale to normal size on unfocus:

View child = layout.getChildAt(current);
child.animate().scaleX(1f).scaleY(1f).setDuration(400).start();
Tam Huynh
  • 2,026
  • 1
  • 16
  • 20