我在布局中使用带有自定义适配器的listview。 现在我想把包含列表的布局带到我的alertdialog。 我尝试将不包含列表的简单布局带到此代码的警告对话框,并且它运行良好。 但我无法将包含布局的列表带入alertdialog。
AlertDialog.Builder dialog = new AlertDialog.Builder( this );
dialog.setView( getLayoutInflater().inflate( R.layout.smill, null ) );
dialog.setIcon(R.drawable.androidsmile);
dialog.setInverseBackgroundForced(true);
dialog.setTitle( "Select smiley");
dialog.setPositiveButton( "Cancel", null );
dialog.show();