以下AlertDialog未显示ICON。我尝试了这个stackoverflow链接中给出的选项。
Alert dialog is not displaying
我尝试了以下选项:
AlertDialog.Builder alertDialog = new AlertDialog.Builder(TriviaActivity.this);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
AlertDialog.Builder alertDialog = new AlertDialog.Buildeer(getApplicationContext()![enter image description here][1]);
请让我知道为什么ICON没有显示。
public void callfacebook()
{
if ( score > 100 )
{ mpc.start(); }
AlertDialog.Builder alertDialog = new AlertDialog.Builder(TriviaActivity.this);
alertDialog.setTitle("");
alertDialog.setIcon(R.drawable.right);
alertDialog.setMessage("\t Your Score is : " + score + " \n\n Please share this in Facebook");
alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent activityIntent = new Intent(TriviaActivity.this,facebookcall.class);
activityIntent.putExtra("messageval","score");
activityIntent.putExtra("level","level5");
startActivity(activityIntent);
}
});
alertDialog.show();
}
答案 0 :(得分:3)
由于你没有设置警告对话框的标题,一旦你有setTitle(“标题文字”),就会显示警告图标
答案 1 :(得分:1)
alertDialog.setTitle("Confirm");
您必须设置标题。