微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试创建警报对话框时出错未触摸

如何解决尝试创建警报对话框时出错未触摸

我正在创建一个一旦显示在屏幕上就无法禁用的警报对话框,该过程可以正常工作,但是因为我遇到了问题,所以在显示警报对话框时它不会停用,但目前按 Any有动作的按钮,动作被激活,我可以移动屏幕。
这是我的 .cs:

private void ProgressBar()
{
    int padding = 30;
    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.Orientation = Android.Widget.Orientation.Horizontal;
    linearLayout.SetPadding(padding,padding,padding);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,LinearLayout.LayoutParams.MatchParent);

    ProgressBar progress = new ProgressBar(this);
    progress.SetPadding(0,0);

    LinearLayout.LayoutParams layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,LinearLayout.LayoutParams.MatchParent);
    layout.Gravity = GravityFlags.Center;
    TextView textView = new TextView(this);
    textView.Text = "Enviando...";
    textView.SetTextColor(Color.ParseColor("#000000"));
    textView.TextSize = 20;

    linearLayout.AddView(progress);
    linearLayout.AddView(textView);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.SetCancelable(true);
    builder.SetView(linearLayout);

    AlertDialog dialog = builder.Create();
    dialog.Show();

    dialog.Window.SetFlags(WindowManagerFlags.Nottouchable,WindowManagerFlags.Nottouchable);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。