Sagar Sagar - 1 month ago 14
Android Question

Alpha Animation acts weird after imageview is moved on touch event in Android

I'm able to successfully make alpha animation work on click of a button. However my imageview can be moved through touch. So when i move my imageview and when i click the fade button it just does not animate it will disappear and appear again.

Also If the imageview is overlapping the original position , it will animate only half of the image(which is overlappint) . It's acting weird not sure why.

I use SetX and SetY to set image's new location.

Can anyone help me out what's the problem?

Answer

I figured things out. Instead of positioning the imageview using setX and setY, use Layoutparams to set the imageview. It will work. I used it and it worked completely fine.