由于某些原因,我无法在 Android Wear 上实现这个简单的概念。我希望 Wear 上的通知具有我选择的纯色背景。以下是我尝试完成此操作的代码:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder
.setContentTitle("title")
.setSmallIcon(R.mipmap.ic_launcher)
.setContentText("Text")
.setColor(Color.YELLOW);
Notification notification = builder.build();
notificationManager.notify(123456, notification);
如您所见,我将通知颜色设置为黄色。这确实在手机上将通知的背景设置为黄色。但是由于某种原因,在Android Wear上看到的通知背景颜色是绿色的。请参见附加的截图。
我尝试使用WearableExtender扩展通知构建器,但它没有类似于“setColor”的方法,只有“setBackground”。为什么Wear会忽略指定的通知颜色?它从哪里获取那个绿色的背景颜色?我该如何覆盖那个颜色?