# RecyclerView.LayoutParams

# RecyclerView.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/RecyclerView.java+class:androidx.recyclerview.widget.RecyclerView.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/RecyclerView.LayoutParams "View this page in Java")

<br />

```
class RecyclerView.LayoutParams : ViewGroup.MarginLayoutParams
```

<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) |

Known direct subclasses  
[GridLayoutManager.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams),[StaggeredGridLayoutManager.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams)  

|----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| [GridLayoutManager.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.LayoutParams)                   | LayoutParams used by GridLayoutManager.          |
| [StaggeredGridLayoutManager.LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/StaggeredGridLayoutManager.LayoutParams) | LayoutParams used by StaggeredGridLayoutManager. |

*** ** * ** ***

[LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html)subclass for children of[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView). Custom[layout managers](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutManager)are encouraged to create their own subclass of this`LayoutParams`class to store any additional required per-child view metadata about the layout.

## Summary

|                                                                                                                                                                             ### Public constructors                                                                                                                                                                              |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LayoutParams](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.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/RecyclerView.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/RecyclerView.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/RecyclerView.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/RecyclerView.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)         | [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.                                                                                                                                                                                                                                     |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### 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[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())       |                                                                                                                                                                                                                                     |

## Public constructors

### LayoutParams

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

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

### LayoutParams

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

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

### LayoutParams

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

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

### LayoutParams

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

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

### LayoutParams

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

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

## Public functions

### getAbsoluteAdapterPosition

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

```
fun getAbsoluteAdapterPosition(): Int
```

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). If the[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)has an[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)that merges other adapters, this position will be with respect to the adapter that is assigned to the[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView).  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the up-to-date adapter position this view with respect to the RecyclerView. It may return[NO_POSITION](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION())if item represented by this View has been removed or its up-to-date position cannot be calculated. |

### getBindingAdapterPosition

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

```
fun getBindingAdapterPosition(): Int
```

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.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the up-to-date adapter position this view relative to the[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)that bound this View. It may return[NO_POSITION](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION())if item represented by this View has been removed or its up-to-date position cannot be calculated. |

### getViewAdapterPosition

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

```
fun [getViewAdapterPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewAdapterPosition())(): Int
```
| **This function is deprecated.**   
|
This method is confusing when nested adapters are used. If you are calling from the context of an[Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter), use[getBindingAdapterPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getBindingAdapterPosition()). If you need the position that[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)sees, use[getAbsoluteAdapterPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getAbsoluteAdapterPosition()).  

### getViewLayoutPosition

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

```
fun getViewLayoutPosition(): Int
```

Returns the adapter position that the view this LayoutParams is attached to corresponds to as of latest layout calculation.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|---------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the adapter position this view as of latest layout pass |

### getViewPosition

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

```
fun [getViewPosition](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutParams#getViewPosition())(): Int
```
| **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())  

### isItemChanged

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

```
fun isItemChanged(): Boolean
```

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been changed in the data set. A LayoutManager may choose to treat it differently in order to animate its changing state.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the item the view corresponds to was changed in the data set |

### isItemRemoved

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

```
fun isItemRemoved(): Boolean
```

Returns true if the adapter data item corresponding to the view this LayoutParams is attached to has been removed from the data set. A LayoutManager may choose to treat it differently in order to animate its outgoing or disappearing state.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the item the view corresponds to was removed from the data set |

### isViewInvalid

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

```
fun isViewInvalid(): Boolean
```

Returns true if the view this LayoutParams is attached to is now representing potentially invalid data. A LayoutManager should scrap/recycle it.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the view is invalid |

### viewNeedsUpdate

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

```
fun viewNeedsUpdate(): Boolean
```

Returns true if the view this LayoutParams is attached to needs to have its content updated from the corresponding adapter.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|--------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if the view should have its content updated |