我创建了一个扩展 View 类的类。
public class SplashScreen extends View
我通过设置 contentview 来使用它
View splash = new SplashScreen(this);
setContentView(splash);
我需要设置背景图像,但我不能使用布局。我想我需要做画布绘图,但我不知道该怎么做。
protected void onDraw(Canvas canvas) {
ballBounds.set(ballX-ballRadius, ballY-ballRadius, ballX+ballRadius, ballY+ballRadius);
paint.setColor(Color.LTGRAY);
// canvas.drawImage(R.drawable.background_image); (Ps: I know there is no function such as drawImage)"
canvas.drawOval(ballBounds, paint);}