簡體   English   中英

Android警報對話框未顯示圖標

[英]Android Alert Dialog not displaying the ICON

下面的AlertDialog未顯示圖標。 我嘗試了這個stackoverflow鏈接中給出的選項。

警報對話框未顯示

我嘗試了以下選項:

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

由於您沒有設置警報對話框的標題,因此一旦設置了setTitle(“ Title Text”),就會顯示警報圖標

 alertDialog.setTitle("Confirm");

您必須設置標題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM