SideSheetDialog

public class SideSheetDialog
extends AppCompatDialog

java.lang.Object
   ↳ android.app.Dialog
     ↳ androidx.activity.ComponentDialog
       ↳ androidx.appcompat.app.AppCompatDialog
         ↳ com.google.android.material.sidesheet.SideSheetDialog


Base class for Dialogs styled as a side sheet.

Summary

Inherited constants

Public constructors

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

Public methods

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

SideSheetBehavior<? extends View> getBehavior()

Returns the behavior associated with this SideSheetDialog.

boolean isDismissWithSheetAnimationEnabled()

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

void setCancelable(boolean cancelable)
void setCanceledOnTouchOutside(boolean cancel)
void setContentView(View view)
void setContentView(int layoutResId)
void setContentView(View view, ViewGroup.LayoutParams params)
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.

Protected methods

void onCreate(Bundle savedInstanceState)
void onStart()

Inherited methods

Public constructors

SideSheetDialog

public SideSheetDialog (Context context)

Parameters
context Context

SideSheetDialog

public SideSheetDialog (Context context, 
                int theme)

Parameters
context Context

theme int

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 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<? extends View> getBehavior ()

Returns the behavior associated with this SideSheetDialog. The behavior must always be a SideSheetBehavior; otherwise, this method will throw an IllegalStateException.

Returns
SideSheetBehavior<? extends View>

isDismissWithSheetAnimationEnabled

public boolean isDismissWithSheetAnimationEnabled ()

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

Returns
boolean

setCancelable

public void setCancelable (boolean cancelable)

Parameters
cancelable boolean

setCanceledOnTouchOutside

public void setCanceledOnTouchOutside (boolean cancel)

Parameters
cancel boolean

setContentView

public void setContentView (View view)

Parameters
view View

setContentView

public void setContentView (int layoutResId)

Parameters
layoutResId int

setContentView

public void setContentView (View view, 
                ViewGroup.LayoutParams params)

Parameters
view View

params ViewGroup.LayoutParams

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
dismissWithAnimation boolean: True if swipe away animation should be used when dismissing.

Protected methods

onCreate

protected void onCreate (Bundle savedInstanceState)

Parameters
savedInstanceState Bundle

onStart

protected void onStart ()