如何在Android中更改状态栏通知图标的颜色/色调(棉花糖及23+以上)? [英] How to change the status bar notification icons' color/tint in android (marshmallow and above 23+)?
本文介绍了如何在Android中更改状态栏通知图标的颜色/色调(棉花糖及23+以上)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所述,如何更改状态栏图标的颜色以使其具有深色而不是默认的白色.
As the title says, how do I change the status bar icons' color to have a dark tint instead of the default white.
FROM
要
推荐答案
要使状态栏图标具有深色而不是默认的白色,请在styles.xml
中添加以下标签(或更确切地说,在
For the status bar icons' to have a dark tint instead of the default white, add the following tag in your styles.xml
(or more precisely in values-v23/styles.xml
) file:
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
您还可以在运行时通过将其设置为任何View
来更改该标志:
You can also change the flag at runtime by setting it to any View
:
View yourView = findViewById(R.id.your_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (yourView != null) {
yourView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
如果您想重置更改,请清除标记,如下所示:
If you want to reset the changes, clear the flag like this:
yourView.setSystemUiVisibility(0);
这篇关于如何在Android中更改状态栏通知图标的颜色/色调(棉花糖及23+以上)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文