Ran*_*and 5 icons android android-recents
我有一个有效的应用程序,但我想添加一个备用版本的应用程序图标,该图标将与最近的应用程序窗口相关联.最近的应用程序窗口将使用另一个,而不是主屏幕上显示的图标.
可以这样做的setTaskDescription(...)方法是在Activity类中使用new 方法.它可用于设置任务的标题和要在最近的应用程序屏幕中显示的任务的图标.这使用ActivityManager.TaskDescription类来设置这些值.请参阅下面的示例.请注意,所有此代码都属于您要修改其任务描述的活动.
Bitmap recentsIcon; // Initialize this to whatever you want
String title; // You can either set the title to whatever you want or just use null and it will default to your app/activity name
int color; // Set the color you want to set the title to, it's a good idea to use the colorPrimary attribute
ActivityManager.TaskDescription description = ActivityManager.TaskDescription(title, recentsIcon, color);
this.setTaskDescription(description);
Run Code Online (Sandbox Code Playgroud)
查看ActivityManager.TaskDescription类文档以及有关使用该类的本文.