4
我有一個工作的應用,但我想添加與最近的應用窗口關聯的應用圖標的替代版本。而不是主屏幕上顯示的圖標,最近的應用程序窗口將使用另一個。Android爲近期應用使用了不同的圖標
我有一個工作的應用,但我想添加與最近的應用窗口關聯的應用圖標的替代版本。而不是主屏幕上顯示的圖標,最近的應用程序窗口將使用另一個。Android爲近期應用使用了不同的圖標
可以這樣做的方法是在Activity類中使用新的setTaskDescription(...)
方法。它可以用來設置任務的標題和要顯示在最近的應用程序屏幕上的任務的圖標。這使用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);
時退房ActivityManager.TaskDescription類文檔以及this article使用的類。