Custom Dialog with align Left and Top margin in android -


i want create custom dialog left , top margins.

i tried this

final dialog dialog = new dialog(home.this);  dialog.getwindow().getattributes().gravity = gravity.left|gravity.top;  dialog.getwindow().setbackgrounddrawable(new colordrawable(android.r.color.transparent)); dialog.setcontentview(r.layout.home_menu);  dialog.show(); 

it align left , top layout.it fine need margins or padding's them.if body know please give me advice how can achieve this.thanks in advance.

try this:

window window = dialog.getwindow();         windowmanager.layoutparams wlp = window.getattributes();          window.setgravity(gravity.left | gravity.top);         dialog.getwindow().getattributes().verticalmargin=0.01f;         dialog.getwindow().getattributes().horizontalmargin=0.01f;         wlp.flags &= ~windowmanager.layoutparams.flag_dim_behind;         window.setattributes(wlp);         dialog.show(); 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -