求助,win10任务栏通知图标栏图标变成红色的了怎么办

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)win7通知栏图标异常怎么办_百度知道
win7通知栏图标异常怎么办
我有更好的答案
win7通知栏图标异常怎么办
采纳率:89%
来自团队:
你可以用 电脑管家→杀毒软件试试看
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。荣耀六怎么修改通知栏图标颜色_百度知道
荣耀六怎么修改通知栏图标颜色
我有更好的答案
hiphotos.baidu.com/zhidao/pic/item/564e5fdf1affb8de9c82d0584fba.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=eca71cdc6b5001ab2f0d/1f819b346fd8cd1b44aed2f73e791.com/zhidao/pic/item/1f819b346fd8cd1b44aed2f73e791.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="http:不可拆卸式电池CPU://f华为荣耀6可以通过更改手机主题来更换通知栏的颜色。换一个全局主题比如这种.com/zhidao/wh%3D600%2C800/sign=1980fe0cedcd7b89ee9f/564e5fdf1affb8de9c82d0584fba.jpg" esrc="http://f.hiphotos://f:八核内存.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="http://f.hiphotos://f:(各版本有所不同)后置摄像头:1300万像素前置摄像头:500万像素华为荣耀6电池容量:3100mAh电池类型
采纳率:92%
为您推荐:
其他类似问题
&#xe675;换一换
回答问题,赢新手礼包&#xe6b9;
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。设置Android通知栏Notification的字体/图标颜色随背景色变化而变化
设置通知栏中的字体/按钮颜色随系统下拉菜单背景色变化而变化
本篇内容为:端APP在下栏菜单中发出通知(Notification)时,在设置该通知背景透明的前提下,如何使得通知中的字体颜色和图标在不同颜色的下栏菜单中均能保持较高的对比度。
常见的方式是为通知加入背景色。有背景色的通知栏虽然保证了文字和图标的对比度,但是不能完美融入不同颜色的下拉菜单中。网易云音乐做得到了背景色透明,且通知栏字色也始终具有较高的对比度,但按钮图标只有一套,在下拉菜单的背景色和图标色相近时会导致按钮不够明显~显示效果如图:
如何使得通知中的字体颜色和图标颜色自适应不同的手机主题呢?文章开篇给出了参考的两篇文章,分别对应着两种解决方案,这里从简描述,有需要的童鞋可点击链接查看详细内容。我重点讲述取之长,补之短的方案三。
因为系统通知的文字颜色会随着(不同主题的)下拉菜单的背景色变化而变化,该方法设置自定义通知的文字颜色与系统通知的文字颜色相同,从而达到保证文字对比度的目的。
这个方案给出了低于5.0的Android版本和高于5.0的Android版本的不同的方案,简而言之就是:在低于5.0的Android版本中,在通知的布局文件(.xml)中的题目Title和简介Introduction中,分别添加如下的一行语句:
android:textAppearance=&@style/TextAppearance.StatusBar.EventContent&
在高于5.0的版本中,在通知的布局文件中表示Title的中添加一行语句:
android:textAppearance=&@android:style/TextAppearance.Material.Notification.Title&
在通知的布局文件中表示简介Introduction的中添加一行语句:
android:textAppearance=&@android:style/TextAppearance.Material.Notification.Line2&
即可实现自定义通知的文字颜色与系统通知的文字颜色相同。
方案一的不足
但是这种方案有两个不足: 低于5.0版本的方案Title和Introduction同色(通常都为灰色),如果要求这两项有不同对比度,则该方案欠佳; 高于5.0版本的方案,其限制条件&高于5.0版本&就是不足。
方案二通过遍历系统通知的viewGroup,获取系统通知中的字体颜色;继而对字体颜色进行判定,是偏黑色主题还是偏浅色主题;最终根据返回的主题颜色,改变自定义通知中的字体颜色。
代码可读性较高,直接上。拷贝自此,根据实际项目有略微差异。
public boolean isDarkNotificationTheme() {
return !isSimilarColor(Color.BLACK,getNotificationColor(musicService.getApplicationContext()));
public static int getNotificationColor(Context context) {
NotificationCompat.Builder builder=new NotificationCompat.Builder(context);
Notification notification=builder.build();
int layoutId=notification.contentView.getLayoutId();
ViewGroup viewGroup= (ViewGroup) LayoutInflater.from(context).inflate(layoutId, null, false);
if (viewGroup.findViewById(android.R.id.title)!=null) {
return ((TextView) viewGroup.findViewById(android.R.id.title)).getCurrentTextColor();
return findColor(viewGroup);
private boolean isSimilarColor(int baseColor, int color) {
int simpleBaseColor=baseColor|0xff000000;
int simpleColor=color|0xff000000;
int baseRed=Color.red(simpleBaseColor)-Color.red(simpleColor);
int baseGreen=Color.green(simpleBaseColor)-Color.green(simpleColor);
int baseBlue=Color.blue(simpleBaseColor)-Color.blue(simpleColor);
double value=Math.sqrt(baseRed*baseRed+baseGreen*baseGreen+baseBlue*baseBlue);
if (value&180.0) {
private static int findColor(ViewGroup viewGroupSource) {
int color=Color.TRANSPARENT;
LinkedList viewGroups=new LinkedList&&();
viewGroups.add(viewGroupSource);
while (viewGroups.size()&0) {
ViewGroup viewGroup1=viewGroups.getFirst();
for (int i = 0; i & viewGroup1.getChildCount(); i++) {
if (viewGroup1.getChildAt(i) instanceof ViewGroup) {
viewGroups.add((ViewGroup) viewGroup1.getChildAt(i));
else if (viewGroup1.getChildAt(i) instanceof TextView) {
if (((TextView) viewGroup1.getChildAt(i)).getCurrentTextColor()!=-1) {
color=((TextView) viewGroup1.getChildAt(i)).getCurrentTextColor();
viewGroups.remove(viewGroup1);
contentView.setInt(R.id.share_content, &setTextColor&, NotificationUtils.isDarkNotificationTheme()==true?Color.WHITE:Color.BLACK);
实现颜色替换的功能。
优势:可自定义通知中Title和Introduction的字体颜色;
劣势:好像依旧无法更换通知中的按钮。
此外,我尝试通过返回的isDarkNotificationTheme()的具体结果,通过以下代码更改通知中字体的颜色和图标:
private TextView notificationTitleTextV
private TextView notificationSubtitleTextV
private ImageView notificationPlayorpauseImageV
View view = LayoutInflater.from(MusicPlayer.this).inflate(R.layout.music_notification, null);
notificationTitleTextView = (TextView) view.findViewById(R.id.notification_title_textView);
notificationsubTitleTextView = (TextView) view.findViewById(R.id.notification_subtitle_textView);
notificationPlayorpauseImageView = (ImageView) view.findViewById(R.id.notification_subtitle_textView);
if(isDarkNotificationTheme()){
notificationTitleTextView.setTextColor(getResources().getColor(R.color.black));
notificationsubtitleTextView.setTextColor(getResources().getColor(R.color.gray));
notificationPlayorpauseImageView.setImageResource(R.mipmap.playOrPauseImageView);
//如上,替换成不同的颜色/图标
但是发现在通知中并没有起效果,也就是说这种方式并不适用于通知。
方案三包括两部分内容,其一是针对方案一的一点小改动,以符合无视Android版本都能进行适配的要求;但并不能解决无法更换图标的问题。其二是结合方案一和方案二,实现最终的文字颜色/图标随手机主题更换后背景色变化而变化。
留心方案一中高于Android 5.0版本的方法:虽然
&@android:style/TextAppearance.Material.Notification.Line2&
要求的最低版本为API 21,但
&@android:style/TextAppearance.Material.Notification.Title&
要求的最低版本为仅为API 9. 考虑到现在市面上几乎全部Android手机的Android版本的API都高于API 9, 可在Title的中设置
android:textAppearance=&@android:style/TextAppearance.Material.Notification.Title&
在Introduction的中设置
android:textAppearance=&@style/TextAppearance.StatusBar.EventContent&
即可实现保持Title和Introduction高对比度的前提下,Title和Introduction具有不同的灰度颜色(Title为黑/白,Introduction为不同程度的灰色)。
改进后的优劣:
优势:简单方便;更换深/浅色主题后自定义通知的字体颜色立即做响应改变。
劣势:文字颜色不能自定义;不能改变图标颜色。
1)因为方案一有简单、背景变化时文字颜色响应迅速的特点,在通知的字体颜色上采用方式一;
2)利用方案二,获知当前主题是深色还是浅色,之后根据主题色采用不同颜色的图标。
在通知的布局文件中表示Title的中添加一行语句:
android:textAppearance=&@android:style/TextAppearance.Material.Notification.Title&
在通知的布局文件中表示简介Introduction的中添加一行语句:
android:textAppearance=&@style/TextAppearance.StatusBar.EventContent&
首先使用方案二,获取到当前主题色是深色还是浅色:
public boolean isDarkNotificationTheme() {
return !isSimilarColor(Color.BLACK,getNotificationColor(musicService.getApplicationContext()));
public static int getNotificationColor(Context context) {
NotificationCompat.Builder builder=new NotificationCompat.Builder(context);
notification=builder.build();
int layoutId=notification.contentView.getLayoutId();
ViewGroup viewGroup= (ViewGroup) LayoutInflater.from(context).inflate(layoutId, null, false);
if (viewGroup.findViewById(android.R.id.title)!=null) {
return ((TextView) viewGroup.findViewById(android.R.id.title)).getCurrentTextColor();
return findColor(viewGroup);
private boolean isSimilarColor(int baseColor, int color) {
int simpleBaseColor=baseColor|0xff000000;
int simpleColor=color|0xff000000;
int baseRed=Color.red(simpleBaseColor)-Color.red(simpleColor);
int baseGreen=Color.green(simpleBaseColor)-Color.green(simpleColor);
int baseBlue=Color.blue(simpleBaseColor)-Color.blue(simpleColor);
double value=Math.sqrt(baseRed*baseRed+baseGreen*baseGreen+baseBlue*baseBlue);
if (value&180.0) {
private static int findColor(ViewGroup viewGroupSource) {
int color=Color.TRANSPARENT;
LinkedList viewGroups=new LinkedList&&();
viewGroups.add(viewGroupSource);
while (viewGroups.size()&0) {
ViewGroup viewGroup1=viewGroups.getFirst();
for (int i = 0; i & viewGroup1.getChildCount(); i++) {
if (viewGroup1.getChildAt(i) instanceof ViewGroup) {
viewGroups.add((ViewGroup) viewGroup1.getChildAt(i));
else if (viewGroup1.getChildAt(i) instanceof TextView) {
if (((TextView) viewGroup1.getChildAt(i)).getCurrentTextColor()!=-1) {
color=((TextView) viewGroup1.getChildAt(i)).getCurrentTextColor();
viewGroups.remove(viewGroup1);
之后实现更换通知中图标的函数,函数中调用Android自带的更新通知中文字和图标的方法setImageViewResource:
public void setNotificationColor(){
if(isDarkNotificationTheme()){
setImageViewResource(R.id.notification_play_pause, R.mipmap.ic_audio_playing_night);
setImageViewResource(R.id.notification_img_next, R.mipmap.ic_audio_next_night);
setImageViewResource(R.id.notification_play_pause, R.mipmap.ic_audio_playing);
setImageViewResource(R.id.notification_img_next, R.mipmap.ic_audio_next);
refreshView();
// private Notification notification builder.build();
// public static NotificationManager notificationManager = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE);
private void refreshView(){
if(notification != null){
notificationManager.notify(NOTIFICATION_ID, notification);
即大功告成。如果想自己定义通知中Title和Introduction的字体颜色,在setNotificationColor()方法的if语句中中添加
setTextColor(R.id.notification_title_textview, getResources().getColor(R.color.title_color));
setTextColor(R.id.notification_subtitle_textview, getResources().getColor(R.color.title_color));
最终效果如图中最顶端的通知,分别展示在深色主题下和浅色主题下的显示效果:
备注:其中R.mipmap.xxx是在工程中的android/src/main/res/mipmap文件夹中自行添加的图标;R.color.xxxxx是在工程中的android/src/main/res/values/color.xml中自行定义的颜色。桌面图标下的字换颜色及通知栏字体换色
来自 vivo X7
我是v粉我自豪&&
来自 社区电脑版
怎么变色我也想知道
来自 社区手机版
顶顶顶顶顶顶顶
来自 vivo X6D
还能变颜色
来自 vivo X7Plus
我还是第一次听说 同求
来自 vivo X7Plus
楼主知道了记得给我分享一下
来自 vivo X7Plus
开奖|过年天天乐,好礼送不停
24小时全国服务热线
400-678-9688
公众号:vivo智能手机
生活号:vivo智能手机
公众号:vivo智能手机
生活号:vivo智能手机
保存二维码

我要回帖

更多关于 电脑通知栏图标不见 的文章

 

随机推荐