Xamarin Android中的系统级警报对话框
ITNOA 嗨 我想在后台服务中显示系统级警报对话框,但我发现这个答案没有用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
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
我在XamarinAlertDialog
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”,该怎么办。您将如何创建系统警报?