9

I can't seem to find any documentation on changing the color of the header for each in app the multitask view. As you can see in the image below, all the headers are default white ( I know they are webpages, but just using the image to show what I want to be changing).

enter image description here

Dragan Marjanovic
  • 1,287
  • 5
  • 16
  • 27

3 Answers3

9

I just created a plugin called "HeaderColor" for cordova (only for Android devices) that does what you want. I hope it helps you.


Installation:

cordova plugin add cordova-plugin-headercolor

Usage:

window.plugins.headerColor.tint("#becb29");

Result:

enter image description here


Github:

https://github.com/tomloprod/cordova-plugin-headercolor

Community
  • 1
  • 1
tomloprod
  • 7,472
  • 6
  • 48
  • 66
  • The plugin works well in recent apps list, but we can still see the default Android color when loading the application for the first time. Please have a look at this post https://stackoverflow.com/questions/48925640/how-to-configure-status-bar-color-when-application-is-loading-with-cordova Do you know how to fix the first issue? – Kr1 Feb 23 '18 at 20:26
3

If I'm not mistaken (as I may very well be), you can find the instructions from r0adkll's aswer. It basically means that you use this line

Activity.setTaskDescription(new ActivityManager.TaskDescription(label, icon, color));

and because this is Android 5.0 feature (right?) I don't think anyone has created a plugin for this yet. Creating plugins isn't luckily all that hard and there are great tutorials on Cordova documentation. I might also find some time to make this on weekend..

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
  • So the only way to use this is to first make a plugin? And then use that plugin? – Dragan Marjanovic Jan 08 '15 at 11:20
  • @DraganMarjanovic: Unfortunately it seems so currently. The plugin is though extremely simple if it only needs that code and I suppose that for example PhoneGap Build might add support for changing that on _config.xml_ quite soon. As the Android 5.0 is still brand new, I don't think there exists any ready plugin yet, so yes, it first needs to be created and then utilized through JavaScript. – Roope Hakulinen Jan 08 '15 at 11:22
  • Ah ok, I'll look into the plugins and making this hopefully. Will post back if its done, cheers. – Dragan Marjanovic Jan 08 '15 at 11:23
  • 2
    I created a plugin to help with this. It also sets the color of the status bar, but it could be modified easily enough to not do that. https://github.com/internrocket/cordova-plugin-StatusBarColor – brain_bacon Feb 20 '15 at 21:34
  • I created a request for this functionality to be added to cordova-plugin-statusbar. https://issues.apache.org/jira/browse/CB-9742 – Benjamin Humphrey Oct 04 '15 at 07:45
3

You can find an answer in this question

Android Lollipop recents/multitasking header styling, text always black

But I think that the best way to do this is implementing the Material Design style in your app. For example, using

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">

with the support library v21 or

 <style name="AppTheme" parent="android:Theme.Material">

for Android 5.0, the header will have the color defined by the atribute

<item name=”colorPrimary”>@color/my_awesome_color</item>

in your style file.

Take a look at this blog post http://android-developers.blogspot.com.br/2014/10/appcompat-v21-material-design-for-pre.html for more information about how to implement Material design with the support library in your app.

Community
  • 1
  • 1
Renan Ferreira
  • 2,122
  • 3
  • 21
  • 30