无论如何都要将Drawable
传递给像这样的类:
public loadImage(Context context, int drawable, int x, int y, int width, int height) {
this.drawable = context.getResources().getDrawable(drawable);
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
尝试将Drawable
传递给班级:
candyImg = new loadImage(getContext(), getResources().getDrawable(R.drawable.candy), 0, 0, 50, 50);
它说getResources().getDrawable(drawable);
已被弃用。那么我怎样才能将Drawable
传递给像这样的类。