How can I change default black dim background “color” (not the amount of dim) of Dialog?

后端 未结 6 999
野的像风
野的像风 2020-12-05 07:37

\"enter

(This is a random image of showing a Dialog found on the Internet

6条回答
  •  时光取名叫无心
    2020-12-05 08:15

    This worked for me:

    val dialog = AlertDialog.Builder(context)
                    .setView(view)
                    .setCancelable(true)
                    .setPositiveButton(R.string.done_label, { dialog, _ -> dialog.dismiss() })
                    .create()
            dialog.window.setDimAmount(0f)
            dialog.show()
    

    dialog.window.setDimAmount(0f) is the key.

提交回复
热议问题