从点击android的图标提示对话框

时间:2016-04-11 13:35:20

标签: android notifications dialog custom-notificaiton

我有一个通知图标,我想在点击图标时打开自定义对话框查看图片,例如我创建了布局并调用了警告对话框,但它显示在屏幕中间。example how I want it to be    Java code for alert Dialog notification_screen

1 个答案:

答案 0 :(得分: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();