开发者

How to take out title and icon in alertDialog for Android

开发者 https://www.devze.com 2023-01-05 23:10 出处:网络
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

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();
           }
       })
0

精彩评论

暂无评论...
验证码 换一张
取 消