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.
Asked
Active
Viewed 47 times
0

Mithilesh Izardar
- 2,117
- 1
- 13
- 24
-
1Alert dialogs are supposed to appear at center – KISHORE_ZE Apr 11 '16 at 13:41
1 Answers
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
-
I used the PopWindow and it is exactly working how I wanted.But thank you anyway for helping. – Mithilesh Izardar Apr 12 '16 at 04:32