# StaggeredGridLayoutManager.LayoutParams

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

*** ** * ** ***


```
public class StaggeredGridLayoutManager.LayoutParams extends RecyclerView.LayoutParams
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) ||||
|   | ↳ | [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |||
|   |   | ↳ | [androidx.recyclerview.widget.RecyclerView.LayoutParams](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams) ||
|   |   |   | ↳ | [androidx.recyclerview.widget.StaggeredGridLayoutManager.LayoutParams](https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams) |

*** ** * ** ***

LayoutParams used by StaggeredGridLayoutManager.

Note that if the orientation is `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager#VERTICAL()`, the width parameter is ignored and if the orientation is `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager#HORIZONTAL()` the height parameter is ignored because child view is expected to fill all of the space given to it.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#INVALID_SPAN_ID() = -1` Span Id for Views that are not laid out yet. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#LayoutParams(androidx.recyclerview.widget.RecyclerView.LayoutParams)(https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams source)` |
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#LayoutParams(android.view.ViewGroup.LayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html source)` |
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#LayoutParams(android.view.ViewGroup.MarginLayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html source)` |
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#LayoutParams(android.content.Context,android.util.AttributeSet)(https://developer.android.com/reference/android/content/Context.html c, https://developer.android.com/reference/android/util/AttributeSet.html attrs)` |
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#LayoutParams(int,int)(int width, int height)` |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#getSpanIndex()()` Returns the Span index to which this View is assigned. |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#isFullSpan()()` Returns whether this View occupies all available spans or just one. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#setFullSpan(boolean)(boolean fullSpan)` When set to true, the item will layout using all span area. |

| ### Inherited Constants |
|---|
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `static final int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#FILL_PARENT = -1` **This field is deprecated.** | | `static final int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT = -1` | | `static final int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT = -2` | |

| ### Inherited fields |
|---|
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#height` | | `https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters.html` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#layoutAnimationParameters` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#width` | |
| From [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#bottomMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#leftMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#rightMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#topMargin` | |

| ### Inherited methods |
|---|
| From [androidx.recyclerview.widget.RecyclerView.LayoutParams](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams) |---|---| | `int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getAbsoluteAdapterPosition()()` Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to in the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView`. | | `int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getBindingAdapterPosition()()` Returns the up-to-date adapter position that the view this LayoutParams is attached to corresponds to with respect to the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter` that bound this View. | | `int` | `[getViewAdapterPosition](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewAdapterPosition())()` **This method is deprecated.** This method is confusing when nested adapters are used. <br /> | | `int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewLayoutPosition()()` Returns the adapter position that the view this LayoutParams is attached to corresponds to as of latest layout calculation. | | `int` | `[getViewPosition](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewPosition())()` **This method is deprecated.** use `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewLayoutPosition()` or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewAdapterPosition()` <br /> | | `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#isItemChanged()()` Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been changed in the data set. | | `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#isItemRemoved()()` Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been removed from the data set. | | `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#isViewInvalid()()` Returns true if the view this LayoutParams is attached to is now representing potentially invalid data. | | `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutParams#viewNeedsUpdate()()` Returns true if the view this LayoutParams is attached to needs to have its content updated from the corresponding adapter. | |
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `void` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#setBaseAttributes(android.content.res.TypedArray, int, int)(https://developer.android.com/reference/android/content/res/TypedArray.html a, int widthAttr, int heightAttr)` | |
| From [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getLayoutDirection()()` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginEnd()()` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginStart()()` | | `boolean` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#isMarginRelative()()` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#resolveLayoutDirection(int)(int layoutDirection)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setLayoutDirection(int)(int layoutDirection)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginEnd(int)(int end)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginStart(int)(int start)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMargins(int, int, int, int)(int left, int top, int right, int bottom)` | |

## Constants

### INVALID_SPAN_ID

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

```
public static final int INVALID_SPAN_ID = -1
```

Span Id for Views that are not laid out yet.

## Public constructors

### LayoutParams

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

```
public LayoutParams(RecyclerView.LayoutParams source)
```

### LayoutParams

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

```
public LayoutParams(ViewGroup.LayoutParams source)
```

### LayoutParams

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

```
public LayoutParams(ViewGroup.MarginLayoutParams source)
```

### LayoutParams

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

```
public LayoutParams(Context c, AttributeSet attrs)
```

### LayoutParams

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

```
public LayoutParams(int width, int height)
```

## Public methods

### getSpanIndex

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

```
public final int getSpanIndex()
```

Returns the Span index to which this View is assigned.

| Returns |
|---|---|
| `int` | The Span index of the View. If View is not yet assigned to any span, returns `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#INVALID_SPAN_ID()`. |

### isFullSpan

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

```
public boolean isFullSpan()
```

Returns whether this View occupies all available spans or just one.

| Returns |
|---|---|
| `boolean` | True if the View occupies all spans or false otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#setFullSpan(boolean)` |   |

### setFullSpan

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

```
public void setFullSpan(boolean fullSpan)
```

When set to true, the item will layout using all span area. That means, if orientation is vertical, the view will have full width; if orientation is horizontal, the view will have full height.

| Parameters |
|---|---|
| `boolean fullSpan` | True if this item should traverse all spans. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams#isFullSpan()` |   |