[英]Android Draw Bitmap to Canvas
我想畫一個Bitmap
到Canvas
中的自定義SurfaceView
,但它並沒有在任何地方出現。
在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());
它運行正常,沒有錯誤,但沒有任何顯示。 有人有想法么?
問題在於您繪制了傳遞給drawBitmap方法的對象。 必須正確配置。 看看這個答案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.