【问题标题】:Android Alert Dialog not displaying the ICONAndroid 警报对话框不显示图标
【发布时间】:2014-07-14 07:08:41
【问题描述】:

下面的 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]);

请告诉我为什么图标没有显示。

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

【问题讨论】:

    标签: android android-alertdialog


    【解决方案1】:

    因为你没有设置警告对话框的标题,一旦你设置了 setTitle("Title Text") 就会显示警告图标

    【讨论】:

      【解决方案2】:
       alertDialog.setTitle("Confirm");
      

      你必须设置标题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-01-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多