Return to Video

Scrolling in Parallel

  • 0:00 - 0:02
    When I say scrolling in parallel,
  • 0:02 - 0:06
    what I'm really talking
    about is Parallax Scrolling.
  • 0:06 - 0:10
    And Parallax Scrolling as in we
    have different layers of views
  • 0:10 - 0:13
    scrolling at different speeds.
  • 0:13 - 0:17
    It's one way that we create the illusion
    of depth in material, and it's really
  • 0:17 - 0:21
    easy to do with Recycler view when
    targeting Honeycomb and above devices.
  • 0:21 - 0:23
    Now our app will continue
    to work on Gingerbread,
  • 0:23 - 0:25
    just without Parallax Scrolling.
  • 0:25 - 0:29
    Now we're only going to add this
    scrolling into our phone landscape view.
  • 0:29 - 0:32
    And it's easy to do this by
    creating a view that can only be
  • 0:32 - 0:33
    found in landscape.
  • 0:33 - 0:40
    Inside of our landscape frag bit main,
    we'll rename at bar to parallax bar.
  • 0:40 - 0:44
    Then inside of our Forecast Fragment
    if we find parallax bar and
  • 0:44 - 0:49
    we're on at least Honeycombe, add an on
    scroll listener to our Recycler view.
  • 0:49 - 0:52
    The cool thing about recycler
    view is that it unlike list view
  • 0:52 - 0:55
    actually returns the delta x or
    y scroll.
  • 0:55 - 1:01
    And this is perfect because we can
    use this to set translation y to move
  • 1:01 - 1:06
    our parallaxview up and down in response
    to the scrolling of our Recycler view.
  • 1:06 - 1:09
    The regular list view does not actually
    return you these delta coordinates at
  • 1:09 - 1:11
    all, and it's somewhat frustrating.
Title:
Scrolling in Parallel
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
UD855 - Android Fundamentals 2
Duration:
01:12

English subtitles

Revisions Compare revisions