Android ImageView背景图片和颜色碰撞

时间:2016-09-05 07:32:50

标签: android

有没有办法解决这个问题?我只能有其中一种,无论是颜色还是可绘制的。

.first

我不能使用drawable,因为它位于适配器和" getResources()"不被承认。

1 个答案:

答案 0 :(得分:0)

回答你的" getResources()"无法识别

在适配器构造函数中传递上下文..

public class MyAdaptet extend BaseAdapter{

private Context ctx;

public MyAdapter(Context context){
     this.ctx=context;
}

并使用此 ctx 来获取

之类的可绘制内容

ctx.getResource()等......

}