我注意到Weather Timeline (例如)在peek和ambient中显示两行通知。我想为我的需求复制它,但我不能这样做。我已经尝试了InboxStyle和BigTextStyle,但都没有用。图标的位置也不同,因此可以显示更多的标题。
这是可能的吗,或者是因为Weather Timeline是一个“穿戴应用”?

NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("TestTitle")
.setContentText("TestContextTextLoremIpsum");发布于 2016-07-26 07:12:45
根据system UI style的不同,通知卡可能会覆盖屏幕的重要部分。你的表盘应该适应这些情况,确保用户仍然可以在通知卡存在的情况下知道时间。
您需要确定PEEK卡上方的空闲空间,以便调整您的手表表面,使用WatchFaceService.Engine.getPeekCardPosition()方法。这提供了它在底部窥视时的位置,并允许手表表面暴露出来。
Watch faces不应干扰系统UI元素,如Accommodate System UI Elements中所述。如果您的手表表面背景较浅或在屏幕底部附近显示信息,则可能需要配置通知卡的大小或启用背景保护。
@Override
public void onCreate(SurfaceHolder holder) {
super.onCreate(holder);
// configure the system UI
setWatchFaceStyle(new WatchFaceStyle.Builder(AnalogWatchFaceService.this)
.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
.setBackgroundVisibility(WatchFaceStyle
.BACKGROUND_VISIBILITY_INTERRUPTIVE)
.setShowSystemUiTime(false)
.build());
...
}上面的代码片段将窥探卡配置为单行高,将窥视卡的背景配置为仅显示简短且仅用于中断通知,并将系统时间设置为不显示。
https://stackoverflow.com/questions/38233033
复制相似问题