# Toolbar.LayoutParams

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

*** ** * ** ***


```
public class Toolbar.LayoutParams extends ActionBar.LayoutParams
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) ||||
|   | ↳ | [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |||
|   |   | ↳ | [androidx.appcompat.app.ActionBar.LayoutParams](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.LayoutParams) ||
|   |   |   | ↳ | [androidx.appcompat.widget.Toolbar.LayoutParams](https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams) |

*** ** * ** ***

Layout information for child views of Toolbars.

Toolbar.LayoutParams extends ActionBar.LayoutParams for compatibility with existing ActionBar API. See `https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity#setSupportActionBar(androidx.appcompat.widget.Toolbar)` for more info on how to use a Toolbar as your Activity's ActionBar.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(int)(int gravity)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(androidx.appcompat.app.ActionBar.LayoutParams)(https://developer.android.com/reference/androidx/appcompat/app/ActionBar.LayoutParams source)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(androidx.appcompat.widget.Toolbar.LayoutParams)(https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams source)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(android.view.ViewGroup.LayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html source)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(android.view.ViewGroup.MarginLayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html source)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(android.content.Context,android.util.AttributeSet)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html c, https://developer.android.com/reference/android/util/AttributeSet.html attrs)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(int,int)(int width, int height)` |
| `https://developer.android.com/reference/androidx/appcompat/widget/Toolbar.LayoutParams#LayoutParams(int,int,int)(int width, int height, int gravity)` |

| ### 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 [androidx.appcompat.app.ActionBar.LayoutParams](https://developer.android.com/reference/androidx/appcompat/app/ActionBar.LayoutParams) |---|---| | `int` | `https://developer.android.com/reference/androidx/appcompat/app/ActionBar.LayoutParams#gravity()` Gravity for the view associated with these LayoutParams. | |
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#height` | | `https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters.html` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#layoutAnimationParameters` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#width` | |
| From [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#bottomMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#leftMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#rightMargin` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#topMargin` | |

| ### Inherited methods |
|---|
| From [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) |---|---| | `void` | `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#setBaseAttributes(android.content.res.TypedArray, int, int)(https://developer.android.com/reference/android/content/res/TypedArray.html a, int widthAttr, int heightAttr)` | |
| From [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html) |---|---| | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getLayoutDirection()()` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginEnd()()` | | `int` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#getMarginStart()()` | | `boolean` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#isMarginRelative()()` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#resolveLayoutDirection(int)(int layoutDirection)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setLayoutDirection(int)(int layoutDirection)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginEnd(int)(int end)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMarginStart(int)(int start)` | | `void` | `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams.html#setMargins(int, int, int, int)(int left, int top, int right, int bottom)` | |

## Public constructors

### LayoutParams

```
public LayoutParams(int gravity)
```

### LayoutParams

```
public LayoutParams(ActionBar.LayoutParams source)
```

### LayoutParams

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

```
public LayoutParams(Toolbar.LayoutParams source)
```

### LayoutParams

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

### LayoutParams

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

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

### LayoutParams

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

### LayoutParams

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

### LayoutParams

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