[英]Notification.BigTextStyle not appearing
所以我正在学习使用BigTextStyle在xamarin android中进行通知。 由于某种原因,每当我运行代码时,bigText和SetSummaryText都不会出现在通知中。 有人知道为什么吗? 我的代码如下:
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
Notification.Builder builder = new Notification.Builder(this)
.SetContentTitle("Big Text")
.SetSmallIcon(Resource.Drawable.Icon);
Notification.BigTextStyle textStyle = new Notification.BigTextStyle();
string longTextMessage = "I went up on one pair of stairs.";
longTextMessage += " / Just like me. ";
textStyle.BigText(longTextMessage);
textStyle.SetSummaryText("The summary text goes here. ");
builder.SetStyle(textStyle);
Notification notification = builder.Build();
NotificationManager notificationManager =
GetSystemService(Context.NotificationService) as NotificationManager;
const int notificationId = 0;
notificationManager.Notify(notificationId, notification);
}
var notification = new Notification.Builder(Application.Context)
.SetSmallIcon(Resource.Mipmap.Icon)
.SetLargeIcon(BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Mipmap.Icon))
.SetAutoCancel(true)
.SetStyle(new Notification
.BigTextStyle()
.SetSummaryText("Summary Text")
.SetBigContentTitle("Content Title")
.BigText("Big Text Area")
)
.Build();
var notificationManager = (NotificationManager)Application.Context.GetSystemService(Context.NotificationService);
notificationManager.Notify(1, notification);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.