I posted this on stack overflow a little over a week ago and got no
response so I will ask here.

I have an activity with a slidingdrawer that comes up as a menu. when
the activity starts the button (it is actually not a button but a
textview but that is really irrelevant) with an  is there and fades
out to allow a full screen view. when the button on top of the drawer
is clicked (it has alpha of 0 at this point) it should fade back in
and the menu popup. when clicked again the menu collapses and the
button fades back out. to do this I have the following code in the
activity.

The initial fadeout works as expected. The activity is created and the
button fades out. when I click the button to expand the menu the
button does not appear and when I click it again the button is there
and does not fade out. The odd thing is that the animation is in fact
called and if I move the scrolviews behind the drawer while the
animation after the animatin is called the animation does go on
normally as long as I keep the views in its background moving. If I
stop moving those views the animation will freeze at some alpha value.




Why does the first function normally while the others do not? How do I
fix this?

drawer = (SlidingDrawer) this.findViewById(R.id.slidingDrawer1);
    drawer.setOnDrawerCloseListener(new OnDrawerCloseListener(){

        public void onDrawerClosed() {
            doFadeOut();
        }
    });
    drawer.setOnDrawerOpenListener(new OnDrawerOpenListener(){

        public void onDrawerOpened() {
            doFadeIn();
        }
    });


fadeOut = AnimationUtils.loadAnimation(this, R.anim.buttonfadeout);
    fadeOut.setFillAfter(true);
    fadeIn = AnimationUtils.loadAnimation(this, R.anim.buttonfadein);
    fadeIn.setFillAfter(true);
    doFadeOut(); //this is the end of onCreate and fades when the
activity is created





and these are methods in the activity

public void doFadeOut(){
    fadeOut.reset();
    menuButton.clearAnimation();
    menuButton.startAnimation(fadeOut);
}

public void doFadeIn(){
    fadeIn.reset();
    menuButton.clearAnimation();
    menuButton.startAnimation(fadeIn);
}




fadein anim

<alpha xmlns:android="http://schemas.android.com/apk/res/android";
    android:duration="500"
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:fillEnabled="true"
    android:fillAfter="true" />

fadeout anim

<alpha xmlns:android="http://schemas.android.com/apk/res/android";
    android:duration="2000"
    android:fromAlpha="1.0"
    android:toAlpha="0.0"
    android:fillEnabled="true"
    android:fillAfter="true"/>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to