【问题标题】:Is this a dialog or activity?这是对话还是活动?
【发布时间】:2011-02-19 12:18:37
【问题描述】:

当您在 Gmail 应用程序中长按电子邮件时,会显示对话框。我想知道它只是一个对话框还是一个表示为对话框的活动?谢谢你。

【问题讨论】:

    标签: android


    【解决方案1】:

    可能它应该是Dialog,当您选择/单击项目时,它可能会根据命令类型打开Activity。但是Activty 可以显示为Dialog,但这里对话框中的项目与同一活动的上下文相关,因此这里不能是新活动。

    【讨论】:

      【解决方案2】:

      您的屏幕截图代码应如下所示。 Here there is no need to dismiss your dialog, when selected option it automatically dismissed.

      AlertDialog dialog ;
      Charsequence str[]={"Test1","Test2"};
      
      
      AlertDialog.Builder builder=new AlertDialog.Builder(this);
      builder.setTitle("Your Title Here");
      builder.setItems(str, new DialogInterface.OnClickListener() {
      
                  @Override
                  public void onClick(DialogInterface dialog, int position) {
                      //here you can use like this... str[position]
      
                  }
      
              });
              dialog = builder.create();
              dialog.show();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-11-18
        • 1970-01-01
        • 2013-10-31
        • 1970-01-01
        • 2014-12-01
        • 2010-09-30
        • 1970-01-01
        相关资源
        最近更新 更多