It seems switching between Theme.AppCompat.Light.DarkActionBar and Theme.AppCompat.Light has no effect on the text color and "close" button inside the recents menu. colorPrimary
changes the header color, but the text and button are always black. Any ideas?
Welcome to Android 5.0 Lollipop—the largest and most ambitious release for Android yet! This release is packed with new features for users and thousands of new APIs for developers. It extends Android even further, from phones, tablets, and wearables, to TVs and cars.
Google has redesigned the "Recents" multitasking menu in Android 11 with bigger panels and new buttons too as part of the third developer preview. Switch site Exclusives Pixel Google Pixel 6 Google Pixel 6 Pro Google Pixel 6a Google Pixel 7 Google Pixel 7 Pro Pixel Buds A-Series Pixel Buds Pro Pixel Watch Pixel Tablet Nest Google Nest Hub
You can set the maximum number of tasks that your app can include in the Recents screen by setting the <activity> attribute android:maxRecents to an integer value. The default is 16. When the maximum number of tasks is reached, the least recently used task is removed from the Recents screen.
You can always exclude a task from the Recents screen entirely by setting the <activity> attribute, android:excludeFromRecents to true. You can set the maximum number of tasks that your app can include in the Recents screen by setting the <activity> attribute android:maxRecents to an integer value.
For as far as I can tell you cannot change the color of the label text and close button because it is automatically set by the system. The only things that you can control are the icon, bar color, and label text via:
Activity.setTaskDescription(new ActivityManager.TaskDescription(label, icon, color));
You can test and see how the system automatically chooses the label and close button colors by supplying a dark or light color to the above function (i.e. set it to black, the text will be white and vice versa).
Docs: https://developer.android.com/about/versions/android-5.0.html#Recents
Javadocs: https://developer.android.com/reference/android/app/Activity.html#setTaskDescription(android.app.ActivityManager.TaskDescription)
-- EDIT -- Here's more details on how the platform determines the text color for the tasks.
The SystemUI app shows the recent task UI. It has a Task model Task.java:156 which detects if the contrast between your colorPrimary (specified in the task description) and white is above 3 it will use the light color. See Utilities.java:119 on how the contrast computation is done.
The text colors used for light and dark can be found here in SystemUI's colors.xml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With