8

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?

Android Overview Screen, Creative Commons Attribution 2.5

whlk
  • 15,487
  • 13
  • 66
  • 96

1 Answers1

22

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);
Kayhan Asghari
  • 2,817
  • 1
  • 28
  • 47
alanv
  • 23,966
  • 4
  • 93
  • 80
  • 1
    I keep getting an error that the primaryColor needs to be Opaque. I have verified it is indeed opaque. Could it some how be conflicting with my theme or when I call the code? – Codeversed Nov 18 '14 at 13:18
  • SOLVED - I had colorPrimary not set to Alpha 255 which caused the issue. It seems to use that first before setting your custom color. – Codeversed Nov 18 '14 at 15:31
  • 1
    @Codeversed Good rule of thumb with Android is to add FF to the start of every colour code your use (or another value if you don't full 100% alpha). – Flatlyn Dec 10 '14 at 17:52
  • I have set theme in my app with colorPrimaryDark,colorPrimary,colorAccent style color. I have tried your code also. Its works fine with pain color I mean without Opacity But when I added alpha colors it will carsh If I use "4DFFFFFF" color app crash. Work fine with "FFFFFF" color – Bhavin Chauhan Mar 20 '15 at 07:18
  • @alanv Is there any help for this issue? http://stackoverflow.com/questions/29161776/android-material-theme-alpha-color-issue – Bhavin Chauhan Mar 20 '15 at 10:45