val builder = AlertDialog.Builder(this, R.style.
CustomDialogTheme)
val inflater =
layoutInflater
val dialogLayout = inflater.inflate(R.layout.
dialog_check, null)
val viewBackground = dialogLayout.findViewById<LinearLayout>(R.id.
dialog_check_background)
val viewContainer = dialogLayout.findViewById<CardView>(R.id.
dialog_check_container)
val buttonOk = dialogLayout.findViewById<TextView>(R.id.
dialog_check_text_ok)
buttonOk.setText(R.string.
button_logout)
val text = dialogLayout.findViewById<TextView>(R.id.
dialog_check_text)
text.setText(R.string.
text_logout)
val buttonClose = dialogLayout.findViewById<TextView>(R.id.
dialog_check_text_cancel)
builder.setView(dialogLayout)
val alert = builder.create()
alert.show()
viewBackground.setOnClickListener
{
alert.dismiss()
}
viewContainer.setOnClickListener
{ }
buttonOk.setOnClickListener
{
mainViewModel.logoutUser()
alert.dismiss()
}
buttonClose.setOnClickListener
{
alert.dismiss()
}Примерно так можно, если своя вью