在概览(最近的应用程序)屏幕中设置应用程序的标题颜色 [英] Setting header color of app in overview (recent apps) screen

查看:29
本文介绍了在概览(最近的应用程序)屏幕中设置应用程序的标题颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为应用添加一些 Lollipop 独有的样式.

I'm adding some Lollipop-only styling to an app.

我想在这里更改 Gmail 等概览屏幕中标题的颜色:

I want to change color of header in overview screeen like Gmail here:

我发现我可以做到

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="android:colorPrimary">@color/my_favorite_color</item>

</style>

来实现它,但我只想为这种情况指定颜色,就像我可以做的那样:

to achieve it, but I would want to specify only the color for this case, just like I can do:

<item name="android:statusBarColor">@color/my_favorite_color<item>

是否有特定的属性来设置标题的颜色?

Is there a specific attribute to set header's color?

附带问题:图标和标题也可以更改吗?

Side question: can icon and title be also changed?

推荐答案

您可以通过 ActivityManager.TaskDescription 更改此设置:

You can change this via ActivityManager.TaskDescription:

https://developer.android.com/reference/android/app/ActivityManager.TaskDescription.html

从活动上下文中,调用:

From an Activity context, call:

TaskDescription taskDescription = new TaskDescription(label, icon, colorPrimary);
((Activity)this).setTaskDescription(taskDescription);

这篇关于在概览(最近的应用程序)屏幕中设置应用程序的标题颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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