Android Set Dialog Background Transparent (Kotlin)

dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))

Example

class BusyDialogFragment: DialogFragment() {    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {        // return super.onCreateView(inflater, container, savedInstanceState)        // make white background transparent        dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))        return activity!!.layoutInflater.inflate(R.layout.busy, container)    }}

NOTE: To remove dark overlay background, refer to Remove Dialog Black Overlay Background

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.