Home > Enterprise >  Transparent background for constraint layout in android not working
Transparent background for constraint layout in android not working

Time:09-05

Transparent background for constraint layout in android not working

I'm trying to make a custom android dialog with rounded corners. enter image description here

As you can see, the corners are rounded, but it leaves the white corner still intact.

CodePudding user response:

If you using Fragment that extends with DialogFragment()

 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    requireDialog().window?.setBackgroundDrawableResource(R.drawable.white_curve_with_blue_outline)//you can use here the drawable
    requireDialog().window?.setBackgroundDrawable(ColorDrawable(Color.parseColor("#BF303030")))//you can use here the color/Transparent


}

CodePudding user response:

Try this in your dialogue activity

yourDialogName.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
  • Related