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 Create an Animation in XML

Challenge Task 4 of 4 Finally, set the duration of this animation to 2 seconds. Bummer! Check the instructions

Challenge Task 4 of 4

Finally, set the duration of this animation to 2 seconds. Bummer! Check the instructions again for what to use as the duration. Hint: You need to use milliseconds.

i want to know how to set animation duration in milliseconds

drop.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <objectAnimator android:propertyName="y" 
                  android:valueFrom= "0"
                  android:valueTo="400"
                  android:duration= "120"/>


</set>

2 Answers

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:propertyName="y" android:valueFrom= "0" android:valueTo="400" android:duration= "2000"/>

</set>

Sana Khateeb
Sana Khateeb
3,979 Points

1000 milliseconds = 1 second, so you want to set the duration to 2000.