user749873
user749873

Reputation: 43

How to do horizontal slide animation from left to right on images with fade effect in single activity in android?

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

Answers (1)

luotasha
luotasha

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

Related Questions