0

I'm trying to create an overlay that is triggered when a button is pressed. This overlay is supposed to allow the user to add their contact and I was wondering how can I use fragments to get this effect like you can see in this mockup.Adobe XD Mockup I am in a dilemna over using fragments is the right choice. My reasoning being that I only need to have it do one task that is adding contacts, and thus I do not need a whole activity.

This is what I have on the main activity right nowMain Activity Java File Main Activity xml File

I would really appreciate any help on understanding how to make this work.

1 Answers1

1

You can use a DialogFragment. It behaves like a normal Fragment for the most part. Here is a guide for a basic implementation https://guides.codepath.com/android/using-dialogfragment

They appear automatically in the center of the screen. To get it a bit lower like in your mockup you can change where it is in the window. Here is an answer showing such Position of DialogFragment in Android

avalerio
  • 2,072
  • 1
  • 12
  • 11
  • Ah I see ! Thank you so much I was concerned whether dialog box only handles basic text and image popups but It seems I was incorrect. Thank you for the tip ! – udbhav shrivastava Dec 23 '21 at 08:54