I have an android activity that implements a custom dialog.The application is running ok but the dialog is too small,i want to display a bigger dialog.How can i achieve this
Try this
For setting dialog width and height as per device screen size
Display display;
int DisplayWidth, DisplayHeight, DialogWidth, DialogHeight;
Dialog dialog;
display =((WindowManager)activity_context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
DisplayWidth = display.getWidth();
DisplayHeight = display.getHeight();
if(DisplayHeight > DisplayWidth)
{
DialogWidth = (6 * DisplayWidth) / 7 ;
DialogHeight = (4 * DisplayHeight) / 5 ;
}
else
{
DialogWidth = (6 * DisplayWidth) / 9 ;
DialogHeight = (4 * DisplayHeight) / 5 ;
}
dialog = new Dialog(activity_context);
// Set your dialog width and height dynamically as per your screen.
Window window = dialog.getWindow();
window.setLayout(DialogWidth,DialogHeight);
window.setGravity(Gravity.CENTER);
dialog.show();