如何在我的应用程序中将状态栏设置为白色背景和黑色文本(黑色图标) [英] How to set Status bar to white background and black text (black icon) in my app

查看:99
本文介绍了如何在我的应用程序中将状态栏设置为白色背景和黑色文本(黑色图标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中将状态栏设置为白色背景和黑色文本(和黑色图标).我发现某些应用程序可以做到这一点.但是从谷歌搜索,我找不到任何解决方案可以做到这一点.关于如何设置状态栏的颜色有很多解决方案.就像SystemBarTint一样,它只能设置背景,但不能设置整个状态栏的样式(白色背景和黑色文字或黑色背景和白色文字颜色.

I want to set the status bar to white background and black text(and black icon) in my app. I found some apps can do this. But search from google, I can not found any solution to do this.There is a lot solutions about how to set status bar's color.Also like SystemBarTint ,It just can set background, but not set the whole status bar's style(white background and black text OR black background and white text color).

推荐答案

我发现此解决方案使用以下代码:

I found this solution use this code:

  getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
 getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 
  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

getWindow().setStatusBarColor(Color.TRANSPARENT);// SDK21

这篇关于如何在我的应用程序中将状态栏设置为白色背景和黑色文本(黑色图标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆