Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I want to change color of header in overview screeen like Gmail here:
enter image description 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?

like image 540
MaciejGórski Avatar asked Nov 22 '14 16:11

MaciejGórski


People also ask

How do I turn on recent items on Android?

To open the recent apps overview, tap on the Home button, and then swipe upward. Make this swipe short (if you swipe too far, you'll open the App Drawer instead).

What is recents app?

The Recents screen (also referred to as the Overview screen, recent task list, or recent apps) is a system-level UI that lists recently accessed activities and tasks. The user can navigate through the list and select a task to resume, or the user can remove a task from the list by swiping it away.


1 Answers

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); 
like image 153
Tim Malseed Avatar answered Sep 20 '22 03:09

Tim Malseed