The children's book company has got back to us and they're not happy with the first page of our interactive book. It says that the ball is rolling, but it isn't!
We're going to fix this by using an
ObjectAnimator to move the ball backwards and forwards across the screen.
InteractiveBook.javaand add a new import declaration:
This should come as no surprise! I already told you that we would be using the ObjectAnimator class.
onCreate()method, and add the following lines:
View rollingBall = findViewById(R.id.rollingball); ObjectAnimator ballRoller = ObjectAnimator.ofFloat( rollingBall, "TranslationX", 0, 400 );