我使用 onDraw 方法显示图像,如下所示:
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.photo0);
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(background, 0, 0, null);
我想将此图像设置为背景,但它仅显示在屏幕的一部分上。怎么设置成全屏?
有一种方法可以将图像设置为 xml 的背景,并通过 onDraw 方法在此图像上绘制其他图像?