添加<代码>LinearLayout 劳动报酬
<代码>#onCreate(Bundle):
...
...
/*LinearLayout*/ mDlgLayout = new LinearLayout(this);
mDlgLayout.setOrientation(LinearLayout.VERTICAL);
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Some title");
alert.setView(mDlgLayout);
alert.setNeutralButton("Regenerate", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
// onClick will dismiss the dialog, just posting delayed
// to pop up the dialog again & change the layout.
mDlgLayout.postDelayed(new Runnable() {
public void run() {
alterDlgLayout();
}
}, 200L);
}
});
/*AlertDialog*/ mDlg = alert.create();
...
...
http://www.un.org
void alterDlgLayout() {
mDlgLayout.removeAllViews();
Random rnd = new Random(System.currentTimeMillis());
int n = rnd.nextInt(3) + 1;
for (int i = 0; i < n; i++) {
EditText txt = new EditText(this);
txt.setHint("Some hint" + rnd.nextInt(100));
mDlgLayout.addView(txt);
}
mDlgLayout.invalidate();
mDlg.show();
}
http://www.un.org/Depts/DGACM/index_french.htm
alterDlgLayout();
http://www.un.org/Depts/DGACM/index_french.htm
mDlg.dismiss();