2015-01-07 27 views

回答

8

可以這樣做的方法是在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使用的類。

相關問題