You can't control the size of AlertDialog like that. The point of AlertDialog is an easy way to through up various standard kinds of dialogs with a standard appearance that you don't control very much. If you want more control, use Dialog.
On Fri, Dec 10, 2010 at 8:20 PM, sat <sathvikm...@gmail.com> wrote: > Hi, > Can you point me to some examples where AlertDialogs are built using > Dialog class ? I have seen Custom dialog box code , where I can refer > to XML and set the contentView. > But my requirement is, depending on the array of strings I would like > to show them as a textview inside an AlertDialog , which is done by > default AlertDialog.Builder. > > On Dec 10, 11:56 pm, Doug Gordon <gordo...@gmail.com> wrote: > > In a similar situation, I stopped using AlertDialog and went directly > > to the Dialog class. You can do everything you need to do that way, > > but a bit more complex since you don't get some of the shortcuts that > > AlertDialog provides. > > > > Doug Gordon > > > > On Dec 10, 7:39 am, sat <sathvikm...@gmail.com> wrote: > > > > > > > > > > > > > > > > > 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 ? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en