how to control the width and height of default alert dialog in Android?

Posted by sat on Stack Overflow See other posts from Stack Overflow or by sat
Published on 2010-12-10T08:04:57Z Indexed on 2010/12/24 5:54 UTC
Read the original article Hit count: 165

Filed under:
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Title");
            builder.setItems(items, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
                }
            });
            AlertDialog alert = builder.create();

I am using above code to show alert dialog , By default it fills the screen in width and wrap_content in height.
How to control the width and height of default alert dialog ?
I tried , alert.getWindow().setLayout(100,100); // It dint work.
How to get the layout params on the alert window and set manually the width and height ?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-widget