# GridLayoutManager.LayoutParams

# GridLayoutManager.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/GridLayoutManager.java+class:androidx.recyclerview.widget.GridLayoutManager.LayoutParams)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/recyclerview/widget/GridLayoutManager.LayoutParams "View this page in Java")

<br />

```
class GridLayoutManager.LayoutParams : RecyclerView.LayoutParams
```

<br />

|---|---|---|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.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/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams)              ||
|   |   |   | ↳ | [androidx.recyclerview.widget.GridLayoutManager.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams) |

*** ** * ** ***

LayoutParams used by GridLayoutManager.

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

## Summary

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [INVALID_SPAN_ID](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#INVALID_SPAN_ID())` = -1` Span Id for Views that are not laid out yet. |

|                                                                                                                                                                                ### Public constructors                                                                                                                                                                                |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#LayoutParams(androidx.recyclerview.widget.RecyclerView.LayoutParams))`(source: `[RecyclerView.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams)`!)`                                      |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#LayoutParams(android.view.ViewGroup.LayoutParams))`(source: `[ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html)`!)`                                                                                 |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#LayoutParams(android.view.ViewGroup.MarginLayoutParams))`(source: `[ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)`!)`                                                               |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#LayoutParams(android.content.Context,android.util.AttributeSet))`(c: `[Context](https://developer.android.com/reference/android/content/Context.html)`!, attrs: `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)`!)` |
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#LayoutParams(int,int))`(width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                       |

|                            ### Public functions                             |
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getSpanIndex](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#getSpanIndex())`()` Returns the current span index of this View.     |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [getSpanSize](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams#getSpanSize())`()` Returns the number of spans occupied by this View. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Inherited Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [FILL_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#FILL_PARENT())` = -1` **This property is deprecated.** | | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MATCH_PARENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#MATCH_PARENT())` = -1`                                | | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [WRAP_CONTENT](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#WRAP_CONTENT())` = -2`                                | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.recyclerview.widget.RecyclerView.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams) |-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getAbsoluteAdapterPosition](https://developer.android.com/reference/kotlin/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[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView).                                                                                                                     | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getBindingAdapterPosition](https://developer.android.com/reference/kotlin/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[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)that bound this View.                                                                                   | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | ~~[getViewAdapterPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewAdapterPosition())~~`()` **This function is deprecated.** This method is confusing when nested adapters are used. <br />                                                                                                                                                                                                                                               | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getViewLayoutPosition](https://developer.android.com/reference/kotlin/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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | ~~[getViewPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewPosition())~~`()` **This function is deprecated.** use[getViewLayoutPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewLayoutPosition())or[getViewAdapterPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewAdapterPosition()) <br /> | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isItemChanged](https://developer.android.com/reference/kotlin/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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isItemRemoved](https://developer.android.com/reference/kotlin/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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isViewInvalid](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#isViewInvalid())`()` Returns true if the view this LayoutParams is attached to is now representing potentially invalid data.                                                                                                                                                                                                                                                             | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [viewNeedsUpdate](https://developer.android.com/reference/kotlin/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) |-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setBaseAttributes](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#setBaseAttributes(android.content.res.TypedArray, int, int))`(a: `[TypedArray](https://developer.android.com/reference/android/content/res/TypedArray.html)`!, widthAttr: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, heightAttr: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| From[android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getLayoutDirection())`()`                                                                                                                                                                                                                                                                                                                                                       | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getMarginEnd](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginEnd())`()`                                                                                                                                                                                                                                                                                                                                                                   | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [getMarginStart](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginStart())`()`                                                                                                                                                                                                                                                                                                                                                               | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isMarginRelative](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#isMarginRelative())`()`                                                                                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [resolveLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#resolveLayoutDirection(int))`(layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setLayoutDirection](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setLayoutDirection(int))`(layoutDirection: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMarginEnd](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginEnd(int))`(end: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMarginStart](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginStart(int))`(start: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)`                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [setMargins](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMargins(int, int, int, int))`(left: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, top: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, right: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, bottom: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` |                                                                                                                                                                                                                           |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ### Inherited properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                           | [height](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#height())                                       | | [LayoutAnimationController.AnimationParameters](https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters.html)`!` | [layoutAnimationParameters](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#layoutAnimationParameters()) | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                           | [width](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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [bottomMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#bottomMargin()) | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [leftMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#leftMargin())     | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [rightMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#rightMargin())   | | [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [topMargin](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#topMargin())       |                                                                                                                                                                                                                                     |

## Constants

### INVALID_SPAN_ID

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

```
const val INVALID_SPAN_ID = -1: Int
```

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)  

```
LayoutParams(source: RecyclerView.LayoutParams!)
```  

### LayoutParams

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

```
LayoutParams(source: ViewGroup.LayoutParams!)
```  

### LayoutParams

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

```
LayoutParams(source: ViewGroup.MarginLayoutParams!)
```  

### LayoutParams

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

```
LayoutParams(c: Context!, attrs: AttributeSet!)
```  

### LayoutParams

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

```
LayoutParams(width: Int, height: Int)
```  

## Public functions

### getSpanIndex

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

```
fun getSpanIndex(): Int
```

Returns the current span index of this View. If the View is not laid out yet, the return value is`undefined`.

Starting with RecyclerView**24.2.0** , span indices are always indexed from position 0 even if the layout is RTL. In a vertical GridLayoutManager,**leftmost** span is span 0 if the layout is**LTR** and**rightmost** span is span 0 if the layout is**RTL** . Prior to 24.2.0, it was the opposite which was conflicting with[getSpanIndex](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.SpanSizeLookup#getSpanIndex(int,int)).

If the View occupies multiple spans, span with the minimum index is returned.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-----------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The span index of the View. |

### getSpanSize

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

```
fun getSpanSize(): Int
```

Returns the number of spans occupied by this View. If the View not laid out yet, the return value is`undefined`.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|--------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The number of spans occupied by this View. |