Reputation: 555
I would like to know if somebody knows how to animate the translation of the views programatically, not XML, I have the coordinates where these views should go. This is the creation of the view:
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.leftMargin = x;
params.topMargin = y;
my_view.setLayoutParams(params);
holder.addView(my_view);
I need to move and animate this view to other x1,y1 position. Thanks!
Upvotes: 1
Views: 2075
Reputation: 31789
TranslateAnimation animation = new TranslateAnimation(fromX,ToX,FromY,ToY);
layout.startAnimation(animation);
This should work.
Upvotes: 4