https://kotlinlang.org logo
#android
Title
# android
a

Antoine Gagnon

08/05/2020, 4:35 PM
Hi everyone! I’m having some issues figuring out how to use a
Fragment
implementation both in the “normal” way (embedding it in an activity for instance) and also be able to display it as a modal. I know it’s pretty easy with a
DialogFragment
implementation to display it as a modal, but I wanted to know if it’s possible to also display a
Fragment
as a modal, or maybe wrap it in a
DialogFragment
?
✔️ 1
i

Ian Lake

08/05/2020, 5:01 PM
DialogFragments can be added directly to a layout: https://developer.android.com/guide/topics/ui/dialogs#FullscreenDialog
a

Antoine Gagnon

08/05/2020, 5:03 PM
So you’d say everything should be a DialogFragment ?
d

Dinorah Tovar

08/05/2020, 5:28 PM
You can have a Dialog Fragment with full Width and Height
a

Antoine Gagnon

08/05/2020, 5:28 PM
I think I'll go with that and use a DialogFragment in both cases, thanks for the help!
c

Colton Idle

08/11/2020, 12:35 AM
Was searching through here to see if anyone had any tips on getting a DialogFragment to actually have width wrap content. @Ian Lake do you know if that's possible? My custom dialogFragment doesn't seem to expand to fit all of the text in my textView.