更新时间:2022-12-11 14:07:03
您不能那样做。通知有一个布局,你***使用该布局。
You can't do it like that. Notifications have a layout, and you are forced to use that layout.
有一个大的图标,文本和一个小图标。而已。这是很清楚这里所说: http://developer.android.com/design/patterns/notifications html的
A big icon, text, and a little icon. That's it. It's quite clearly stated here: http://developer.android.com/design/patterns/notifications.html
所以,你可以按照这个例子说明在这里:的http://开发商。 android.com/training/wearables/notifications/creating.html
So, you can follow the example explained here: http://developer.android.com/training/wearables/notifications/creating.html
例如:
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setLargeIcon(R.drawable.ic_event2);
.setContentIntent(viewPendingIntent);
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Build the notification and issues it with notification manager.
notificationManager.notify(notificationId, notificationBuilder.build());