0

I am using the Android navigation component to show a DialogFragment. This also works fine, but now I want to have rounded corners on the dialog.

I've seen here that I could use the MaterialAlertDialogBuilder of the Material Design Components (which my app uses anyways), but as the navigation component displays the DialogFragment for me, I have no access to the DialogBuilder that the navigation component uses? Or is there any way to access it?

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
  • What do you mean by 'I have no access to the DialogBuilder that the navigation component uses'? `DialogFragment` lets you use any type of Dialog by overriding `onCreateDialog()`, Navigation has nothing to do with that. – ianhanniballake Mar 21 '20 at 19:30
  • Thanks, you are right - I am still new to Android and understood something wrong. Got it now :-) For others: Here is a detailed blog post about `MaterialAlertDialogBuilder` on medium, also mentioning `DialogFragment` and `onCreateDialog()` https://medium.com/over-engineering/hands-on-with-material-components-for-android-dialogs-75c6d726f83a – stefan.at.kotlin Mar 21 '20 at 22:17

1 Answers1

1

Navigation doesn't control what type of dialog is being created - that is the responsibility of the DialogFragment and specifically its onCreateDialog() method.

It is in onCreateDialog() that you'd use MaterialAlertDialogBuilder to create your dialog with rounded corners.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443