setView

open fun setView(layoutResId: Int): AlertDialog.Builder(source)

Inflates a custom view resource inside the dialog, below the message and above the buttons. If none of the other parts of the dialog are made visible, the custom view occupies the entire view. Because the view is inflated inside the parent dialog's view, take care not to define conflicting resource IDs.

Return

this Builder object to allow for chaining of calls to set methods

Parameters

layoutResId

Resource ID to be inflated.


Sets a custom view to be the contents of the alert dialog.

When using a pre-Holo theme, if the supplied view is an instance of a ListView then the light background will be used.

Note: To ensure consistent styling, the custom view should be inflated or constructed using the alert dialog's themed context obtained via getContext.

Return

this Builder object to allow for chaining of calls to set methods

Parameters

view

the view to use as the contents of the alert dialog


open fun setView(view: View, viewSpacingLeft: Int, viewSpacingTop: Int, viewSpacingRight: Int, viewSpacingBottom: Int): AlertDialog.Builder(source)

Deprecated

This method has been deprecated.

Set a custom view to be the contents of the Dialog, specifying the spacing to appear around that view. If the supplied view is an instance of a ListView the light background will be used.

Return

This Builder object to allow for chaining of calls to set methods This is currently hidden because it seems like people should just be able to put padding around the view.

Parameters

view

The view to use as the contents of the Dialog.

viewSpacingLeft

Spacing between the left edge of the view and the dialog frame

viewSpacingTop

Spacing between the top edge of the view and the dialog frame

viewSpacingRight

Spacing between the right edge of the view and the dialog frame

viewSpacingBottom

Spacing between the bottom edge of the view and the dialog frame