69

I'm using AppCompat and my theme is extending Theme.AppCompat.Light.DarkActionBar.

When in Android 5 Lollipop and I press the recent apps button, my app appears with a dark title instead of a white title in the ActionBar.

When I'm inside the app everything looks fine.

What can I do to change the title color in the recent apps view?

EDIT: just figured out that if I use a darker colorPrimary, the title becomes white. I still need a way to force the white title with the original color.

enter image description here

Christian Göllner
  • 5,808
  • 4
  • 19
  • 20
  • 1
    Instead of using a darker color as colorPrimary, I set the recents color as colorPrimaryDark. Just like the status bar color is darker, recents color is also darker for me and the title became white. I think it is the best way to do it. Thank you for the question and the great app unclouded – tasomaniac Apr 14 '15 at 18:01

3 Answers3

53

You can't force the text color, it is auto generated (either white/black) based on your colorPrimary color.

Chris Banes
  • 31,763
  • 16
  • 59
  • 50
  • 10
    Here's the code in question if you're interested: https://github.com/android/platform_frameworks_base/blob/lollipop-release/packages/SystemUI/src/com/android/systemui/recents/model/Task.java#L147 – Chris Banes Dec 30 '14 at 10:07
  • I would add that this colorPrimary which affects the color of the text is defined in your app theme as an item. Like: `@color/colorPrimary` – Timo Albert Sep 12 '17 at 09:21
39

I also looked into this and the best way I could find was (suggestion from MrEngineer13) setting my recents app color to the 600-value of my primary color:

Bitmap bm = BitmapFactory.decodeResource(getResources(), app_icon);
TaskDescription taskDesc = new TaskDescription(getString(R.string.app_name), bm, getResources().getColor(R.color.primary_600));
MainActivity.setTaskDescription(taskDesc);

If you look closely at the Android 5.0 contacts app, you can see that Google themselves is also doing something similar:

Screenshot Android contacts

Therefore I believe it is impossible to change the title color yourself, but Android will choose a good one for you. (which will also allow Android to change it for accessibility reasons,...)

Jeroen Mols
  • 3,436
  • 17
  • 24
  • In spite of I would like to set my own blue, this suit on the app as well. Thanks! – David Corral Aug 11 '16 at 10:46
  • 2
    Thank you! This is the **real** answer. I used the "white text" on the palette. For example, Light Blue 600 - #039BE5, the palette shows white label for it on the website. – Jared Burrows Sep 27 '16 at 05:13
25

To change the color/title/icon you just need to use the following:

TaskDescription tDesc = new TaskDescription(mTitle, mIcon, mColor);
MainActivity.setTaskDescription(tDesc);
MrEngineer13
  • 38,642
  • 13
  • 74
  • 93