set Close Icon Visible
Show an optional close icon at the end of the snackbar.
The close icon is set to View.GONE by default. Setting the icon to visible will show the icon at the end of the layout and automatically dismiss the snackbar when clicked. This method and other related closeIcon setters can only be used within the context of a Material 3 or greater theme.
When using a close icon, please consider setting the snackbar's duration to
Snackbar.LENGTH_INDEFINITE.
This method will automatically remove any end padding from the snackbar layout to properly align the close icon button. To manually set end padding, use getView and call setPaddingRelative before showing the snackbar.
Parameters
visible
true to make the close icon visible