Android 5.0: howto change Overview Screen Task Tit

2020-06-16 02:25发布

问题:

The new Android 5.0 Lollipop Overview Screen features each App's Task with a screenshot and a (by default) grey title bar.

Some Lollipop Apps (For example the new Play Store) use different colours. How can the colour of the Overview Screen title background be changed?

回答1:

In general, if you're targeting Material then you should set colorPrimary (action bar, recents), colorPrimaryDark (status bar), and colorAccent (check boxes, progress bars, etc) in your theme.

That said, you can dynamically change the recents color to be something else using:

TaskDescription taskDesc = new TaskDescription(myTitle, myIcon, myColor);
myActivity.setTaskDescription(taskDesc);