简体   繁体   English

警报对话框不显示任何内容

[英]Alert dialog doesn't show anything

I have an Alert Dialog and when I press the button to show what I chose, it shows nothing, only the black faded screen like something has to show.我有一个警报对话框,当我按下按钮以显示我选择的内容时,它什么也不显示,只有黑色褪色的屏幕必须显示。

There is my code:有我的代码:

final AlertDialog.Builder raspunsgresit = new AlertDialog.Builder(Intrebarea644.this);
LayoutInflater factory = LayoutInflater.from(Intrebarea644.this);
final View view = factory.inflate(R.layout.raspuns644, null);
raspunsgresit.setView(view);
if(view.getParent()!=null)
   ((ViewGroup)view.getParent()).removeView(view);
raspunsgresit.setPositiveButton("", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dlg, int sumthin) {
            }
    });

It's just the AlertDialog.Builder .它只是AlertDialog.Builder You need to create() the AlertDialog then show() it.您需要create() AlertDialog然后show()它。 So, your code will look like :因此,您的代码将如下所示:

final AlertDialog.Builder raspunsgresit = new AlertDialog.Builder(Intrebarea644.this);
LayoutInflater factory = LayoutInflater.from(Intrebarea644.this);
final View view = factory.inflate(R.layout.raspuns644, null);
raspunsgresit.setView(view);
if(view.getParent()!=null)
 ((ViewGroup)view.getParent()).removeView(view);
raspunsgresit.setPositiveButton("", new DialogInterface.OnClickListener(){
 public void onClick(DialogInterface dlg, int sumthin){
 }
});
raspunsgresit.create().show();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM