在alertdialog按钮的大小 [英] Size of button in alertdialog

查看:439
本文介绍了在alertdialog按钮的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改按钮的大小在code alertdailog不使用XML?
我不使用视图。

how can i change the size of button in alertdailog in code without using xml ? I'm not using view ..

感谢您
在code:
  alertbox3.setNeutralButton(取消,新DialogInterface.OnClickListener(){公共无效的onClick(DialogInterface对话,诠释它){}});

推荐答案

您可以试试这个code:

you may try this code:

 AlertDialog.Builder adb = new AlertDialog.Builder(this);
 Dialog d = adb.setView(new View(this)).create();
// (That new View is just there to have something inside the dialog that can grow big enough to cover the whole screen.)

WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(d.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.FILL_PARENT;
d.show();
d.getWindow().setAttributes(lp);


http://developer.android.com/reference/android/widget/Button.html

看看这个链接ASLO。 <一href=\"http://stackoverflow.com/questions/4250923/how-to-change-a-buttons-icon-programmatically\">Link1和 LINK2

look at this link aslo . Link1 and LInk2

这篇关于在alertdialog按钮的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆