【发布时间】:2015-02-15 20:32:06
【问题描述】:
我正在尝试在自定义SurfaceView 中将Bitmap 绘制到Canvas,但它没有出现在任何地方。
在SurfaceView,我正在使用:
//in the constructor
Bitmap leftUp = BitmapFactory.decodeResources(R.drawable.leftup);
leftCurrent = leftUp; //it's a button - leftUp and leftDown
//in my drawing method
canvas.drawBitmap(leftCurrent, controlsWidth, controlsHeight, new Paint());
它运行正常,没有错误,但没有任何显示。有人有什么想法吗?
【问题讨论】:
-
你的surfaceview有宽度和高度吗? ,你检查过 controlsWidth 和 controlsHeight 不是 0 吗?
-
你想在另一个图像上还是在空白视图上绘制它?