0
由於某種原因,我在android中派生了一個類BitmapDrawable,但我想知道如何爲我的類指定資源ID(我的意思是繪圖文件夾中的圖標)?設置資源繪製到BitmapDrawable
作爲資源對象的超級構造函數(但我的類無權訪問 getResources()),因此如何將Resource id設置爲BitmapDrawable。
但我認爲越來越getResources不會幫我BitmapDrawable 沒有(RES資源,INT ID)構造
static class DownloadedDrawable extends BitmapDrawable {
private final WeakReference<BitmapDownloaderTask> bitmapDownloaderTaskReference;
public DownloadedDrawable(BitmapDownloaderTask bitmapDownloaderTask) {
bitmapDownloaderTaskReference =
new WeakReference<BitmapDownloaderTask>(bitmapDownloaderTask);
}
public BitmapDownloaderTask getBitmapDownloaderTask() {
return bitmapDownloaderTaskReference.get();
}
}
我的班級是不活動 – Hunt 2012-02-29 22:31:59
內獲得的資源在哪裏會這樣呢? this.getContext()。getRseources()可以工作,我認爲。 – ChristopheCVB 2012-02-29 22:44:38
我知道這將工作,但我的課是一個單獨的,並與一個異步 – Hunt 2012-03-01 04:54:09