0

I need to create a dialog which drops down from a clicked position on the screen.

I have considered using a floating ContextMenu, but I need to customize the contents of the dropdown to display my own views.

context menu

I have also considered using a custom DialogFragment but this is not subtle enough and interrupts the flow.

enter image description here

How can I create something in between?

A perfect example would be the dropdown dialog used by Duolingo:

good example

I have also considered just adding a framelayout to the point where the user clicks but I'm not sure how to recreate the dept of a ContextMenu or how to create a decent animation when the dialog is fading in and out.

I dont want to display a list of options within the dialog, I want to display a custom layout with a number of textviews and buttons.

Kes Walker
  • 1,154
  • 2
  • 10
  • 24

1 Answers1

1

Check these libraries, it will help you

https://github.com/MasayukiSuda/BubbleLayout?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=3564

https://github.com/piruin/quickaction?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=5746

You can also make it without library:

  1. Create custom dialog
  2. Set dialog animation

    override Dialog onCreateDialog(Bundle savedInstanceState){
        ...
        Dialog dialog = new Dialog(context);
        dialog.setWindowAnimations(R.style.anim_dropdown);
        return dialog;
    }
    
  3. Changing position of the Dialog on screen android

Mahmoud Waked
  • 357
  • 2
  • 8