对话框秩序的Andr​​oid [英] Dialogs order in Android

查看:115
本文介绍了对话框秩序的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么样的安卓对话框的命令呢?

is there something like dialog's order in Android?

我解释一下我的意思。

有一个对话框,建设者用OK - 按钮。当用户preSS OK,对话框将被关闭。

There is a dialog builder with "OK"-Button. When user press ok, dialog will be closed.

德恩我打电话后,对方不止一个对话框,在活动中,我第一次看到的最后一个,然后倒数等。但我想首先看到的第一个对话框,然后是第二个,然后...

Wenn I call more than one dialogs after each other in an activity, I see first the last one, then next to last and so on. But I would like to see first the first dialog, then the second, then ...

有可能是什么?

或者是有可能不调用第二个对话框,直到第一个对话框没有关闭?

Or is it possible not to call second dialog until first dialog isn't closed?

穆尔

推荐答案

当你定义的的onClick()方法,你的对话框的确定按钮( setNeutralButton()),你就必须显示第二个对话框(通过的ShowDialog()或类似的),然后关闭该第一个对话框

When you define the onClick() method for your dialog's "Ok" button (setNeutralButton()), you'll have to display the second dialog (via showDialog() or similar) and then dismiss the first dialog.

一个例子:

builder = new Builder(context);
builder
    .setTitle(R.string.dialog_download_failed_title)
    .setMessage(R.string.dialog_download_failed_message)
    .setCancelable(true)
    .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            showDialog(SECOND_DIALOG);
            dialog.dismiss();
        }
    });

这篇关于对话框秩序的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆