# RecyclerViewParallax

Artifact: [androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/RecyclerViewParallax.java+class:androidx.leanback.widget.RecyclerViewParallax) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***


```
public class RecyclerViewParallax extends Parallax<RecyclerViewParallax.ChildPositionProperty>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.leanback.widget.Parallax](https://developer.android.com/reference/androidx/leanback/widget/Parallax)\<[RecyclerViewParallax.ChildPositionProperty](https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax.ChildPositionProperty)\> ||
|   | ↳ | [androidx.leanback.widget.RecyclerViewParallax](https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax) |

Known direct subclasses [DetailsParallax](https://developer.android.com/reference/androidx/leanback/widget/DetailsParallax)

|---|---|
| `https://developer.android.com/reference/androidx/leanback/widget/DetailsParallax` | Subclass of Parallax object that tracks overview row's top and bottom edge in DetailsFragment or DetailsSupportFragment. |

*** ** * ** ***

Implementation of `https://developer.android.com/reference/androidx/leanback/widget/Parallax` class for `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView`. This class allows users to track position of specific views inside `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView` relative to itself. See `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax.ChildPositionProperty` for details.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax.ChildPositionProperty extends https://developer.android.com/reference/androidx/leanback/widget/Parallax.IntProperty` Subclass of `https://developer.android.com/reference/androidx/leanback/widget/Parallax.IntProperty`. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#RecyclerViewParallax()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax.ChildPositionProperty` | `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#createProperty(java.lang.String,int)(https://developer.android.com/reference/java/lang/String.html name, int index)` Create a new Property object. |
| `float` | `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#getMaxValue()()` Return the max value which is typically size of parent visible area, e.g. RecyclerView's height if we are tracking Y position of a child. |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView` | `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#getRecyclerView()()` |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#setRecyclerView(androidx.recyclerview.widget.RecyclerView)(https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView recyclerView)` Set RecyclerView that this Parallax will register onScrollListener. |
| `void` | `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax#updateValues()()` Manually update values. |

### Inherited methods

From [androidx.leanback.widget.Parallax](https://developer.android.com/reference/androidx/leanback/widget/Parallax) `https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#addEffect(androidx.leanback.widget.Parallax.PropertyMarkerValue...)(Parallax.PropertyMarkerValue[] ranges)`

Create a `https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect` object that will track source variable changes within a provided set of ranges.
`final PropertyT` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#addProperty(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)`

Add a new IntProperty in the Parallax object.
`https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect>` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#getEffects()()`

Returns a list of `https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect` object which defines rules to perform mapping to multiple `https://developer.android.com/reference/androidx/leanback/widget/ParallaxTarget`s.
`final https://developer.android.com/reference/java/util/List.html<PropertyT>` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#getProperties()()` `void` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#removeAllEffects()()`

Remove all `https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect` objects.
`void` `https://developer.android.com/reference/androidx/leanback/widget/Parallax#removeEffect(androidx.leanback.widget.ParallaxEffect)(https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect effect)`

Remove the `https://developer.android.com/reference/androidx/leanback/widget/ParallaxEffect` object.

## Public constructors

### RecyclerViewParallax

Added in 1.1.0

```
public RecyclerViewParallax()
```

## Public methods

### createProperty

```
public RecyclerViewParallax.ChildPositionProperty createProperty(String name, int index)
```

Create a new Property object. App does not directly call this method. See `https://developer.android.com/reference/androidx/leanback/widget/Parallax#addProperty(java.lang.String)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html name` | Name of the property in this Parallax object |
| `int index` | Index of the property in this Parallax object. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/widget/RecyclerViewParallax.ChildPositionProperty` | Newly created Property object. |

### getMaxValue

```
public float getMaxValue()
```

Return the max value which is typically size of parent visible area, e.g. RecyclerView's height if we are tracking Y position of a child. The size can be used to calculate marker value using the provided fraction of FloatPropertyMarkerValue.

| Returns |
|---|---|
| `float` | Size of parent visible area. |

### getRecyclerView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public RecyclerView getRecyclerView()
```

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView` | Currently RecylerView that the source has registered onScrollListener. |

### setRecyclerView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public void setRecyclerView(RecyclerView recyclerView)
```

Set RecyclerView that this Parallax will register onScrollListener.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView recyclerView` | RecyclerView to register onScrollListener. |

### updateValues

```
public void updateValues()
```

Manually update values. This is used for changes not controlled by RecyclerView. E.g. called by a Slide transition that changes translation of the view.