Hangout
使用特定的Notification
,在Android Wear
上向右滑动时会显示消息列表。它显示ListView
中的所有邮件。
他们是否使用特定Notification Style
(例如InboxStyle
或BigTextStyle
)?可能是Wear App
吗? (我不这么认为,他们无法通过刷卡进行访问)
答案 0 :(得分:2)
他们正在为其通知添加Pages,允许您为Android Wear设备添加其他内容。
链接中的示例代码:
// Create builder for the main notification
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.new_message)
.setContentTitle("Page 1")
.setContentText("Short message")
.setContentIntent(viewPendingIntent);
// Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
.bigText("A lot of text...");
// Create second page notification
Notification secondPageNotification =
new NotificationCompat.Builder(this)
.setStyle(secondPageStyle)
.build();
// Add second page with wearable extender and extend the main notification
Notification twoPageNotification =
new WearableExtender()
.addPage(secondPageNotification)
.extend(notificationBuilder)
.build();
// Issue the notification
notificationManager =
NotificationManagerCompat.from(this);
notificationManager.notify(notificationId, twoPageNotification);