I need more room in a single AlertDialog and 开发者_如何学运维when I set .title to null it doesn't show a title but it also doesn't add any space to the AlertDialog. The dialog just starts that much lower on the screen. Not using setPosativeButton has the desired effect but I do want the close button. How can I set the AlertDialog so I can show my long Message starting at the top of the screen?
for the title and the text , .. in fact, I assumed that you want to create something like "about" menu.
public void ChooseAbout() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(
"First time here? Check out the FAQ!").setTitle("Hi!");
builder.show();
}
you can use the .setPositiveButton
to finish your activity and .setNegaiveButton
to cancel yours.
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
精彩评论