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 trialEliseo Ramirez
2,181 PointsNext, use the methods to animate the scale of a view to double the image's width and height. Cant Figure out
This is the code that i tried first and how i thought it should be set up
imageView.animate();
private void animate() {
imageView.setScaleX(0);
imageView.setScaleY(0);
imageView.animate().scaleX(2).scaleY(2).start();
}
but then i get all of these compiler errors
JavaTester.java:64: error: ';' expected imageView.animate() ^ JavaTester.java:65: error: illegal start of expression private void animate() { ^ JavaTester.java:65: error: ';' expected private void animate() { ^ JavaTester.java:65: error: ';' expected private void animate() { ^ 4 errors
after that, based off of what the compiler errors say, i changed my code to
imageView.animate();
Private Void animate(); {
imageView.setScaleX(0).setScaleY(0);
imageView.animate().scaleX(2).scaleY(2).start();
}
and it eliminated all but one error
JavaTester.java:65: error: ';' expected Private Void animate(); { ^ 1 error
if i add the semicolon between the void and animate it creates a whole new error
i tried several different ways of setting it up and i cant figure it out so im ready for help
here are the different variations of what i have tried:
imageView.animate(); //<--- with and without semicolon
private void animate() {
imageView.setScaleX(0);
imageView.setScaleY(0);
imageView.animate().scaleX(2).scaleY(2).start();
}
imageView.animate(); //<--- with and without semicolon
private void animate() {
fab.setScaleX(0);
fab.setScaleY(0);
imageView.animate().scaleX(2).scaleY(2).start();
}
// also fab.animate().scaleX(2).scaleY(2).start(); with one above
anyone think they can help?
1 Answer
Karan Kumar
3,830 PointsIt's been answered on this thread: https://teamtreehouse.com/community/animations-and-transitions-android