Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Animations and Transitions Animations Basics Property Animation

Jarvis Chandler
Jarvis Chandler
7,619 Points

I don't understand this code challenge?

You need to animate an image (named imageView) so that it scales up to twice its size when it is tapped. Start by simple calling the animate() method of the image.

CodeChallenge.java
// Use the variable named 'imageView'

Hi Jarvis,

I appreciate you asking me this question, but I honestly do not know as I haven not worked with Android in more than a year. I did a Google search and found some resources that I believe may help you, if not with the challenge, with your endeavors using Android:

https://developer.android.com/reference/android/view/animation/ScaleAnimation.html https://developer.android.com/training/gestures/scale.html http://www.tutorialspoint.com/android/android_animations.htm http://stackoverflow.com/questions/7414065/android-scale-animation-on-view

5 Answers

sandipeklaric
sandipeklaric
10,674 Points

This worked for me :)

1/3

imageView.animate();

2/3

imageView.animate().scaleX(2).scaleY(2);

3/3

imageView.animate().scaleX(2).scaleY(2).start();
Akym Bonheur
Akym Bonheur
6,198 Points

Hi Royce Foo Wai kit what they meant by "calling the animate method" is to use the variable with the method. Like this " imageView.animate();"

Hope I was able to help you start!

Royce Foo Wai Kit
Royce Foo Wai Kit
2,551 Points

Need help with this too.. can't seem to get past even with the code

private void animate(){
    imageView.setScaleX(0);
        imageView.setScaleY(0);
        imageView.animate().scaleX(1).scaleY(1).start();


    }

This solution should help from challenge 1 to 3

imageView.animate().scaleX(2).scaleY(2).start();

thnx sandipeklaric