xamarin - 尝试创建未触摸的警报对话框时出错
问题描述
我正在创建一个警报对话框,一旦它显示在屏幕上就无法禁用,该过程工作但中途因为我遇到问题,当显示警报对话框时它不会停用,但此时按下任何按钮一个动作,动作被激活,我可以移动屏幕。
这是我的 .cs:
private void ProgressBar()
{
int padding = 30;
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.Orientation = Android.Widget.Orientation.Horizontal;
linearLayout.SetPadding(padding, padding, padding, padding);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
ProgressBar progress = new ProgressBar(this);
progress.SetPadding(0, 0, 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);
}
解决方案
推荐阅读
- c++ - 如何使用 CMake 将文件放在目标文件位置旁边?
- php - Jquery无限循环没有关注正确的领域
- java - Java swing 应用程序在线程“AWT-EventQueue-0”中抛出 NullPointerException,原因不明
- javascript - 函数内的 Javascript 暂停
- android - 您通常如何为仪器单元测试执行模拟?
- python - DynamoDB:使用 Python 导入大数据
- c# - SQL 查询的结果永远不会返回 null;
- typescript - TypeScript 导入语句在 Expo 项目中找不到 Firebase 模块
- flutter - Flutter AudioService 每次获取 Fetch Url
- python - Flask 知道主应用程序中的类,但不知道 html 模板中的类