【发布时间】:2016-02-09 22:15:55
【问题描述】:
getDrawable 已弃用。我该如何重写这段代码。我找不到答案。
public static List<Product> getCatalog(Resources res){
if(catalog == null) {
catalog = new Vector<Product>();
catalog.add(new Product("Dead or Alive",src.getDrawable(R.drawable.deadoralive),
"Dead or Alive by Tom Clancy with Grant Blackwood", 29.99));
catalog.add(new Product("Switch", res
.getDrawable(R.drawable.switchbook),
"Switch by Chip Heath and Dan Heath", 24.99));
catalog.add(new Product("Watchmen", res
.getDrawable(R.drawable.watchmen),
"Watchmen by Alan Moore and Dave Gibbons", 14.99));
}
return catalog;
}
什么是使用它功能的新的最佳方式。
【问题讨论】:
-
这是一个重复的问题
-
我知道在这个网站上有人问了很多关于 geDrawable 的问题但是我是 Android 开发的新手,所以我需要确切的答案,因为我无法这样做。
标签: android android-widget android-drawable