开发者

Fadein fadeout for two imageviews overlapped

I want to have fade-in, fade-out effect for two image views

I have two Image-views one overlapped on another I mean two image-views are one above the other,

when we click on the upper image-view it should fadeout and lower image-view should be visible. For the second click on lower image-view it should fadeout and first view should appear.

when i click the upper image-view lowerone is appearing but when I click on the lower one its not fading out, Its remaining there.

How can we achieve this, plz help. here is my code:

mswtview4.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
        FadeoutAnimation.reset();
        mswtview4.startAnimati开发者_Python百科on(FadeoutAnimation);

        FadeoutAnimation.setFillAfter(true);
        mswtview4.setVisibility(View.GONE);
    }
});

 mswtview2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FadeoutAnimation.reset();

            mswtview2.startAnimation(FadeoutAnimation);
        FadeoutAnimation.setFillAfter(true);

            mswtview4.setVisibility(View.VISIBLE);


        }
    });


AlphaAnimation fadeIn = new AlphaAnimation(0.0f , 1.0f ) ; 
fadeIn.setDuration(1200);
fadeIn.setFillAfter(true);

AlphaAnimation fadeOut = new AlphaAnimation( 1.0f , 0.0f ) ; 
fadeOut.setDuration(1200);
fadeOut.setFillAfter(true);

mswtview4.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        mswtview4.startAnimation(fadeOut);
        mswtview4.setVisibility(View.GONE);
    }
});

 mswtview2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            mswtview2.startAnimation(fadeIn);
            mswtview4.setVisibility(View.VISIBLE);


        }
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜