# SideSheetDialog

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/sidesheet/SideSheetDialog.java)

*** ** * ** ***


```
public class SideSheetDialog
```

<br />

*** ** * ** ***

Base class for android.app.Dialogs styled as a side sheet.

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/SideSheet.md) and [design guidelines](https://material.io/components/side-sheets/overview).

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#SideSheetDialog(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#SideSheetDialog(Context,int)(Context context, int theme)` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#cancel()()` This function can be called from a few different use cases, including swiping the dialog away or calling \`dismiss()\` from a \`SideSheetDialogFragment\`, tapping outside a dialog, etc... |
| `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetBehavior<View>` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#getBehavior()()` Returns the behavior associated with this `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog`. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#isDismissWithSheetAnimationEnabled()()` Returns whether dismissing will perform the swipe away animation on the sheet, rather than the window animation for the dialog. |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#onAttachedToWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#onDetachedFromWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setCancelable(boolean)(boolean cancelable)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setCanceledOnTouchOutside(boolean)(boolean cancel)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setContentView(int)(int layoutResId)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setContentView(View)(View view)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setContentView(View,ViewGroup.LayoutParams)(View view, LayoutParams params)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setDismissWithSheetAnimationEnabled(boolean)(boolean dismissWithAnimation)` Set whether to perform the swipe away animation on the sheet when dismissing, rather than the window animation for the dialog. |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setFitsSystemWindows(boolean)(boolean fitsSystemWindows)` Sets whether or not this sheet dialog should account for system screen decorations such as the status bar and inset its content. |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#setSheetEdge(int)(int gravity)` Set the edge which the sheet should originate from. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#onCreate(Bundle)(Bundle savedInstanceState)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog#onStart()()` |

## Public constructors

### SideSheetDialog

```
public SideSheetDialog(Context context)
```

### SideSheetDialog

```
public SideSheetDialog(Context context, int theme)
```

## Public methods

### cancel

```
public void cancel()
```

This function can be called from a few different use cases, including swiping the dialog away or calling \`dismiss()\` from a \`SideSheetDialogFragment\`, tapping outside a dialog, etc...

The default animation to dismiss this dialog is a fade-out transition through a windowAnimation. Set `https://developer.android.com/reference/com/google/android/material/sidesheet/SheetDialog#setDismissWithSheetAnimationEnabled(boolean)` to true if you want to utilize the sheet animation instead.

If this function is called from a swipe interaction, or dismissWithAnimation is false, then keep the default behavior.

### getBehavior

```
public SideSheetBehavior<View> getBehavior()
```

Returns the behavior associated with this `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetDialog`. The behavior must always be a `https://developer.android.com/reference/com/google/android/material/sidesheet/SideSheetBehavior`; otherwise, this method will throw an `https://developer.android.com/reference/java/lang/IllegalStateException`.

### isDismissWithSheetAnimationEnabled

```
public boolean isDismissWithSheetAnimationEnabled()
```

Returns whether dismissing will perform the swipe away animation on the sheet, rather than the window animation for the dialog.

### onAttachedToWindow

```
public void onAttachedToWindow()
```

### onDetachedFromWindow

```
public void onDetachedFromWindow()
```

### setCancelable

```
public void setCancelable(boolean cancelable)
```

### setCanceledOnTouchOutside

```
public void setCanceledOnTouchOutside(boolean cancel)
```

### setContentView

```
public void setContentView(int layoutResId)
```

### setContentView

```
public void setContentView(View view)
```

### setContentView

```
public void setContentView(View view, LayoutParams params)
```

### setDismissWithSheetAnimationEnabled

```
public void setDismissWithSheetAnimationEnabled(boolean dismissWithAnimation)
```

Set whether to perform the swipe away animation on the sheet when dismissing, rather than the window animation for the dialog.

| Parameters |
|---|---|
| `boolean dismissWithAnimation` | True if swipe away animation should be used when dismissing. |

### setFitsSystemWindows

```
public void setFitsSystemWindows(boolean fitsSystemWindows)
```

Sets whether or not this sheet dialog should account for system screen decorations such as the status bar and inset its content. Default is true.

This will forward the `fitsSystemWindows` to the sheet dialog's child views via setFitsSystemWindows, as well as the sheet dialog's window via setDecorFitsSystemWindows.

### setSheetEdge

```
public void setSheetEdge(int gravity)
```

Set the edge which the sheet should originate from.

Note: This method should be called when the sheet is initialized, before it is shown. Runtime sheet edge changes are not supported.

| Parameters |
|---|---|
| `int gravity` | the edge from which the sheet and its animations should originate. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the sheet is null or has already been laid out |

## Protected methods

### onCreate

```
protected void onCreate(Bundle savedInstanceState)
```

### onStart

```
protected void onStart()
```