java - How to disable button while AlphaAnimation running -
i want disable click on button when animation running. code below:
alphaanimation anim = new alphaanimation(0.0f, 1.0f); anim.setduration(4000); anim.setrepeatmode(animation.reverse); btntag.startanimation(anim);
so want cant click button until animation done.
i accomplish using animationlistener. allows run code @ various stages of animation.
this code untested, way should is:
alphaanimation anim = new alphaanimation(0.0f, 1.0f); anim.setduration(4000); anim.setrepeatmode(animation.reverse); anim.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { btntag.setclickable(false); } @override public void onanimationend(animation animation) { btntag.setclickable(true); } @override public void onanimationrepeat(animation animation) {} }); btntag.startanimation(anim);
not sure if btntag button or view holding button, call button's setclickable(boolean clickable)
method enable , disable button.
Comments
Post a Comment