简体   繁体   中英

Fade In and Out animation in Android

I need to create an animation in android,i have one fixed image in the screen, i need to add another image over the previous image using fade in and out.

i have searched and i found something like this

Fade in and out in java

That is the concept, but can i add different image using this method,i have tried simple animation technique also but that is working in every version.

Could somebody help me @Thanks

try this:

public class MyAnimationListener implements AnimationListener {

    @Override
    public void onAnimationEnd(Animation animation) {
        // TODO Auto-generated method stub

        i.setImageResource(R.drawable.bg);
        i.startAnimation(animo);

    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub

    }

}

In Second Activity:

MyAnimationListener mListener = new MyAnimationListener();
        anim.setAnimationListener(mListener);
        i.startAnimation(anim);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM