我有一个警报对话框,当我按下按钮以显示我选择的内容时,它什么也没有显示,只有黑色的褪色屏幕必须显示出来。
有我的代码:
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) {
}
});
答案 0 :(得分:0)
它只是AlertDialog.Builder
。您需要先create()
AlertDialog
,然后show()
。
因此,您的代码将如下所示:
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();