Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use fade in fade out to Background image in android..?

I want to know how to give fade in fade out animation to android:background image. i want to use two or more images and give this animation. pls . how can I do that. in any layout..?

cheers

like image 870
Miuranga Avatar asked Dec 28 '22 18:12

Miuranga


1 Answers

You have to set animation to the layout

You can provide fade_in or fad_out animation to the layout

to set fade_in to layout use the following code

Animation mAnim = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
layout.startAnimation(mAnim);

to set fade_out to layout use the following code

Animation mAnim = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
        layout.startAnimation(mAnim);
like image 135
Sunil Kumar Sahoo Avatar answered Mar 07 '23 04:03

Sunil Kumar Sahoo