Android make button disabled after setting alpha 0 -
probably rhetorical question.
in ios when set view's (any uiview
subclass such uibutton
) alpha 0, ios default disables user interaction on view.
i got android app animate fade out view by:
objectanimator fadeout = objectanimator.offloat(buttonselectioncontainer, "alpha", 1, 0); fadeout.setduration(500); fadeout.start();
however, noticing when tap screen, animation starts again, leading me believe, in android, when button alpha set 0, still tappable, true?
is there way globally tell android disable user interaction view (and subviews) when alpha set 0, either explicitly through using:
view.setalpha(0.0f);
or through objectanimator
above code block used ?
a temporary work around problem schedule code run after 500 ms:
// psuedocode: after 500ms dispatch_dosomethingafter(500) { mybutton.setenabled(false); }
not ideal solution might solution, unless bright android developers out there has better solution ?
use addlistener
on objectanimator
control happens after animation has finished.
fadeout.addlistener(new animator.animatorlistener() { @override public void onanimationstart(animator animation) { } @override public void onanimationend(animator animation) { button.setenabled(false); } @override public void onanimationcancel(animator animation) { } @override public void onanimationrepeat(animator animation) { } });
Comments
Post a Comment