I have a problem in setting the height and width of an Alert Dialog, below is my Code that i have written in OnCreateDialog() method:
AlertDialog dialog = new AlertDialog.Builder(context ,AlertDialog.THEME_HOLO_LIGHT) .setTitle("Title") .setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch(which){ case 0: //some Code break; case 1: //some Code break; } } }) .create(); WindowManager.LayoutParams WMLP = dialog.getWindow().getAttributes(); WMLP.x = 80; //x position WMLP.y = -100; //y position WMLP.height = 100; WMLP.width = 100; dialog.getWindow().setAttributes(WMLP); //OR dialog.getWindow().setLayout(100, 100); Kindly tell me what is the problem here in the Code. Thanks