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