Reset view to original position after animation
up vote
1
down vote
favorite
I'm animating a view and I want to reset the view to the original position after animation ended.
This is what I have:
rl2 is a relativeLayout
rl2.animate().translationX(-60).translationY(117).setDuration(2000);
I tried setting this but its not working:
rl2.clearAnimation();
android
add a comment |
up vote
1
down vote
favorite
I'm animating a view and I want to reset the view to the original position after animation ended.
This is what I have:
rl2 is a relativeLayout
rl2.animate().translationX(-60).translationY(117).setDuration(2000);
I tried setting this but its not working:
rl2.clearAnimation();
android
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm animating a view and I want to reset the view to the original position after animation ended.
This is what I have:
rl2 is a relativeLayout
rl2.animate().translationX(-60).translationY(117).setDuration(2000);
I tried setting this but its not working:
rl2.clearAnimation();
android
I'm animating a view and I want to reset the view to the original position after animation ended.
This is what I have:
rl2 is a relativeLayout
rl2.animate().translationX(-60).translationY(117).setDuration(2000);
I tried setting this but its not working:
rl2.clearAnimation();
android
android
asked Nov 8 at 19:09
Jorge Requez
4417
4417
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
clearAnimation();
does not reset your animations, it just stops them and removes them from the animation queue. To undo your animations you need to actually undo them. So, for your code block you will need to call rl2.animate().translationX(0).translationY(0).setDuration(2000);
to move the view back to its original position.
add a comment |
up vote
0
down vote
As @Chris Stillwell mentioned on his answer, But you can move View
back to it's original position after translation animation by
rl2.animate().translationX(0).translationY(0);
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
clearAnimation();
does not reset your animations, it just stops them and removes them from the animation queue. To undo your animations you need to actually undo them. So, for your code block you will need to call rl2.animate().translationX(0).translationY(0).setDuration(2000);
to move the view back to its original position.
add a comment |
up vote
0
down vote
accepted
clearAnimation();
does not reset your animations, it just stops them and removes them from the animation queue. To undo your animations you need to actually undo them. So, for your code block you will need to call rl2.animate().translationX(0).translationY(0).setDuration(2000);
to move the view back to its original position.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
clearAnimation();
does not reset your animations, it just stops them and removes them from the animation queue. To undo your animations you need to actually undo them. So, for your code block you will need to call rl2.animate().translationX(0).translationY(0).setDuration(2000);
to move the view back to its original position.
clearAnimation();
does not reset your animations, it just stops them and removes them from the animation queue. To undo your animations you need to actually undo them. So, for your code block you will need to call rl2.animate().translationX(0).translationY(0).setDuration(2000);
to move the view back to its original position.
edited Nov 8 at 19:39
answered Nov 8 at 19:15
Chris Stillwell
6,03564152
6,03564152
add a comment |
add a comment |
up vote
0
down vote
As @Chris Stillwell mentioned on his answer, But you can move View
back to it's original position after translation animation by
rl2.animate().translationX(0).translationY(0);
add a comment |
up vote
0
down vote
As @Chris Stillwell mentioned on his answer, But you can move View
back to it's original position after translation animation by
rl2.animate().translationX(0).translationY(0);
add a comment |
up vote
0
down vote
up vote
0
down vote
As @Chris Stillwell mentioned on his answer, But you can move View
back to it's original position after translation animation by
rl2.animate().translationX(0).translationY(0);
As @Chris Stillwell mentioned on his answer, But you can move View
back to it's original position after translation animation by
rl2.animate().translationX(0).translationY(0);
edited Nov 8 at 19:35
answered Nov 8 at 19:29
Khaled Lela
2,52622046
2,52622046
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214586%2freset-view-to-original-position-after-animation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown