Search code examples
androidandroid-dialogfragmentfloating-action-button

Android - Floating action button on top of Dialog Fragment


I've got a Floating Action Button and when I click on it I open a DialogFragment. When the dialog is opened, the button is below the dialog. My question is, how do I position the button after the onclick event on top of the DialogFragment?


Solution

  • Well, I would do this trick : use Fragment and adjust it to look like dialog( you even can use dialog fragment theme ). Then use the same FAB on fragment layout ( Even better you can make transition view for fab. something like zoom out/in )... Here is the complete example uploaded on Github for you :-)

    https://github.com/mabuthraa/Android-FabOverDialog

    I will try later to improve that example by using Fragment theme and transition.

    Good luck,'.