Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin Android中的系统级警报对话框_Xamarin_Xamarin.android_Android Alertdialog_Background Service - Fatal编程技术网

Xamarin Android中的系统级警报对话框

Xamarin Android中的系统级警报对话框,xamarin,xamarin.android,android-alertdialog,background-service,Xamarin,Xamarin.android,Android Alertdialog,Background Service,ITNOA 嗨 我想在后台服务中显示系统级警报对话框,但我发现这个答案没有用 dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); 我在XamarinAlertDialogAPI中找不到它 我现在能做什么 我错过什么了吗 谢谢试试这个: Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(thi

ITNOA

我想在后台服务中显示系统级警报对话框,但我发现这个答案没有用

dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
我在Xamarin
AlertDialog
API中找不到它

我现在能做什么

我错过什么了吗

谢谢

试试这个:

    Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(this);
    alert.SetTitle("Confirm delete");
    alert.SetMessage("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.");
    alert.SetPositiveButton("OK", (senderAlert, args) => {
        Toast.MakeText(this, "Ok button Tapped!", ToastLength.Short).Show();
    });

    Dialog dialog = alert.Create();
    dialog.Window.SetType(Android.Views.WindowManagerTypes.SystemAlert);
    dialog.Show();

如果从简单类需要显示系统警报,您不能使用上下文“this”,该怎么办。您将如何创建系统警报?