android - How can I set maximum height to Dialog? -


i wanna set maximum height of dialog. not custom height set dp or px. wanna set greatest possible height dialog relatively current device screen size.

you can not set max height directly. alternate, can reset height if height greater maximum height want set.

windowmanager.layoutparams lp = new windowmanager.layoutparams(); lp.copyfrom(dialog.getwindow().getattributes()); int dialogwidth = lp.width; int dialogheight = lp.height;  if(dialogheight > max_height) {    d.getwindow().setlayout(width,max_height); }  

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -