Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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