SRam
SRam

Reputation: 2830

animate a image means it become big and small in one place android

hi i want to give animation using only one image in drawable folder means in imageview tag of xml file i increase width and height of same image now i want to animate it in one place i had the code which uses series of images seved in drawale folder and animate it but i have only 1 image ..pls give any suitable example which uses only 1 image and animate that image using imageview height and width increasing..thanks in adv

below is my code..

final ImageView splashImageView = (ImageView) findViewById(R.id.SplashImageView);

    splashImageView.setBackgroundResource(R.drawable.flag);

    final AnimationDrawable frameAnimation = (AnimationDrawable)splashImageView.getBackground();
    splashImageView.post(new Runnable(){
        @Override
        public void run() {
            frameAnimation.start();         
        }           
    });


    final SplashScreen sPlashScreen = this;   

    // The thread to wait for splash screen events
    mSplashThread =  new Thread(){
        @Override
        public void run(){
            try {
                synchronized(this){
                    // Wait given period of time or exit on touch
                    wait(5000);
                }
            } 
            catch(InterruptedException ex){                 
            }



        }
    };

    mSplashThread.start();

}

Upvotes: 1

Views: 2559

Answers (2)

Onuray Sahin
Onuray Sahin

Reputation: 4135

Try this:

ScaleAnimation scaler = new ScaleAnimation((float) 0.7, (float) 1.0, (float) 0.7, (float) 1.0);
scaler.setDuration(40);
imageView1.startAnimation(scaler);

Upvotes: 3

Merlyn Morgan-Graham
Merlyn Morgan-Graham

Reputation: 59151

"become big and small in one place" usually is called scaling.

I didn't really read it (just googled "android scaling images"), but this forum post might help you out. It seems to have a code tutorial:

http://www.anddev.org/resize_and_rotate_image_-_example-t621.html

Upvotes: 1

Related Questions