English subtitles

← Scrolling in Parallel (quiz)

Get Embed Code
5 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. All right, it's your turn now.
  2. You're going to add Parallax Scrolling
    at half the primary scroll
  3. speed to the landscape phone view.
  4. It's going to look something like that.
  5. In layout-land/fragment_main.xml you're
    going to rename appbar to parallax_bar,
  6. just like I did in this little lecture.
  7. And then in ForecastFragment you're
    going to add an onScrollListener to our
  8. Recyclerview.
  9. And then in the onScrollListener,
    you're going to change the translation
  10. y of the parallax bar in
    response to changes in scrolling.
  11. Now, we're scrolling at half speed, so
  12. you'll want to change the translation
    by half of the scroll deltas.
  13. And of course, you'll want to make
    sure that you limit the deltas to
  14. approximately the negative
    height of your view.
  15. Finally clear all your onScroll
    Listeners in onDestroy, very easy to do.