# ViewPager.LayoutParams

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

*** ** * ** ***


```
public class ViewPager.LayoutParams extends ViewGroup.LayoutParams
```

<br />

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

*** ** * ** ***

Layout parameters that should be supplied for views added to a ViewPager.

## Summary

| ### Public fields |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/viewpager/widget/ViewPager.LayoutParams#gravity()` Gravity setting for use on decor views only: Where to position the view page within the overall ViewPager container; constants are defined in `https://developer.android.com/reference/android/view/Gravity.html`. |
| `boolean` | `https://developer.android.com/reference/androidx/viewpager/widget/ViewPager.LayoutParams#isDecor()` true if this view is a decoration on the pager itself and not a view supplied by the adapter. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/viewpager/widget/ViewPager.LayoutParams#LayoutParams()()` |
| `https://developer.android.com/reference/androidx/viewpager/widget/ViewPager.LayoutParams#LayoutParams(android.content.Context,android.util.AttributeSet)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/util/AttributeSet.html attrs)` |

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

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

| ### Inherited methods |
|---|
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `void` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#resolveLayoutDirection(int)(int layoutDirection)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#setBaseAttributes(android.content.res.TypedArray, int, int)(https://developer.android.com/reference/android/content/res/TypedArray.html a, int widthAttr, int heightAttr)` | |

## Public fields

### gravity

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

```
public int gravity
```

Gravity setting for use on decor views only: Where to position the view page within the overall ViewPager container; constants are defined in `https://developer.android.com/reference/android/view/Gravity.html`.

### isDecor

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

```
public boolean isDecor
```

true if this view is a decoration on the pager itself and not a view supplied by the adapter.

## Public constructors

### LayoutParams

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

```
public LayoutParams()
```

### LayoutParams

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

```
public LayoutParams(@NonNull Context context, @Nullable AttributeSet attrs)
```