Reputation: 43
I have five images and I need to do the horizontal animation from left to right with fade effect how can i do this in android please help me to solve this.
Upvotes: 1
Views: 1530
Reputation: 33
asume ur ImageView named 'myView'. here is a snippet:
TranslateAnimation trans = new TranslateAnimation(0, 400, 0, 0);
trans.setDuration(3000);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet combine = new AnimationSet(true);
combine.addAnimation(trans);
combine.addAnimation(alpha);
myView.startAnimation(combine);
u can see a view go from left-top conner move horizonal to right with fade out at same time but the view position will restore to origin after animation. to make view really moved. u need listen animation and set view x, y manually.
Upvotes: 3