Setting header color of app in overview (recent apps) screen

旧巷老猫 提交于 2019-11-27 00:03:50

问题


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

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

I have figured out I can do

<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?


回答1:


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);


来源:https://stackoverflow.com/questions/27079658/setting-header-color-of-app-in-overview-recent-apps-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!