有没有办法解决这个问题?我只能有其中一种,无论是颜色还是可绘制的。
.first
我不能使用drawable,因为它位于适配器和" getResources()"不被承认。
答案 0 :(得分:0)
回答你的" getResources()"无法识别
在适配器构造函数中传递上下文..
public class MyAdaptet extend BaseAdapter{
private Context ctx;
public MyAdapter(Context context){
this.ctx=context;
}
并使用此 ctx 来获取
之类的可绘制内容 ctx.getResource()
等......
}