Solution to the Click Failure Problem of Android displacement animation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.