0

I have a notification icon and I want to open a custom dialog when icon is clicked see image for example i have created the layout and called the alert dialog but it is showing in middle of the screen.example how I want it to be Java code for alert Dialog notification_screen

Mithilesh Izardar
  • 2,117
  • 1
  • 13
  • 24

1 Answers1

2
You can define gravity for an alert dialog by using following piece of code.

WindowManager.LayoutParams wmlp = resolutionDialog.getWindow().getAttributes();
    wmlp.gravity = Gravity.TOP | Gravity.LEFT;
    wmlp.x = 0; // specify x axis position
    wmlp.y = 0; // specify y axis position
    yourDialog.show();
Karthik
  • 381
  • 2
  • 10