Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image animation on Android

Tags:

android

I want an image on an Android screen to appear smaller when the user touches down on it and to get back to its original size when the user releases it. I want the animation to be smooth and I also want to utilize minimum computing resources. How can this best be implemented?

like image 872
Sandah Aung Avatar asked Mar 17 '23 02:03

Sandah Aung


1 Answers

try this code

          @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {

                case MotionEvent.ACTION_DOWN:
                   // do something here when touch
                break;

                case MotionEvent.ACTION_UP:
                   // do something here when touch release     
                break;
                }

                return true;
            }

for animation try this animation-source_code

like image 78
Attaullah Avatar answered Mar 28 '23 17:03

Attaullah