Recently, in doing a button divergence effect animation, but found that the animation after the execution of the original button click event does not execute, after looking at the data only found that the original button after the animation, click on the event to listen to the location or the original position, so after the animation, the position of the control should be moved to the end of the animation position, The specific code is as follows:
Translateanimation.setfillenabled (TRUE); Solve flashing problems after moving
Translateanimation.setanimationlistener (New Animationlistener () {
@Override
public void Onanimationend (Animation arg0) {
/** because the position of the view is unchanged after execution, if a write-click event is required, these re-arrangement should be added view**/
Framelayout.layoutparams params = (framelayout.layoutparams) cameraimage.getlayoutparams ();
Params.bottommargin + = 0;
Params.leftmargin + = r;
Cameraimage.setlayoutparams (params);
}
@Override
public void Onanimationrepeat (Animation arg0) {
}
@Override
public void Onanimationstart (Animation arg0) {
}
});
Demo download
This article from "Mo Panic, raise straight forward" blog, please be sure to keep this source http://kunyali.blog.51cto.com/4890065/1587972
Solution to the Click Failure Problem of Android displacement animation