自定义Notification

RemoteViews remoteViews = new RemoteViews(this.getPackageName(), "自定义通知布局");
remoteViews.setTextViewText("TextView控件ID", "值");//可以设置各种控件
Notification notification = new Notification();
notification.contentView = remoteViews;//设置布局
其他与普通通知相同


现在手机各种主题,通知栏背景颜色各种,如果给通知布局TextView设置固定字体颜色可能出现字体颜色和背景相同。
所以在设置TextView的字体颜色时要给系统颜色,而不是给固定值
android:textColor="@android:color/primary_text_light"这个错了
android:textColor="?android:textColorPrimary"应该是这个

你可能感兴趣的:(自定义Notification)