【发布时间】:2019-10-04 21:21:16
【问题描述】:
我正在关注此链接以创建通知:https://docs.microsoft.com/it-it/xamarin/android/app-fundamentals/notifications/local-notifications
这是我的代码:
Notification.BigTextStyle textStyle = new Notification.BigTextStyle();
// Fill it with text:
string longTextMessage = "I went up one pair of stairs.";
longTextMessage += " / Just like me. ";
//...
textStyle.BigText(longTextMessage);
// Set the summary text:
textStyle.SetSummaryText("The summary text goes here.");
// Plug this style into the builder:
//creo la notifica:
var builder = new NotificationCompat.Builder(instance, "enter")
.SetSmallIcon(global::Android.Resource.Drawable.IcDialogInfo)
.SetContentIntent( pending)
.SetDefaults((int)NotificationDefaults.Sound)
.SetDefaults((int)NotificationDefaults.Vibrate)
.SetNumber(count)
.SetAutoCancel(true)
.SetContentTitle("Proximity") // Set the title
.SetContentText($"benvenuto nel beacon di colore {deskOwner},{count}")
.SetStyle(textStyle)
.Build();
count++;
// Get the notification manager:
NotificationManager notificationManager = instance.GetSystemService(Context.NotificationService) as NotificationManager;
// Pubblico la notifica:
const int notificationId = 0;
notificationManager.Notify(notificationId, builder);
return null;
}
但是在 .SetStyle(textStyle) 给我这个错误: '无法从 'Android.App.Notification.BigTextStyle' 转换为 'Android.Support.V4.App.NotificationCompat.Style' 我该如何解决?
【问题讨论】:
标签: android xamarin xamarin.android