自定义Notification

来源:互联网 发布:ubuntu scrapy 编辑:程序博客网 时间:2024/06/06 01:03
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"应该是这个