Applyed animation moves view to the top of screen

139 views Asked by At

To see my humidityImageView I need to scroll down a little bit. When I apply this animation:

ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(humidityImageView, View.Y,40);
objectAnimator.setDuration(2000);
objectAnimator.setRepeatCount(ValueAnimator.INFINITE);
objectAnimator.start();

it starts fromt the top of the screen, but not from the position of the humidityImageView in my ConstraintLayout. How to make animation starts from the initial view position?

1

There are 1 answers

0
Vadim On

All I needed is replace View.Y to View.TRANSLATION_Y