要学习导弹安卓游戏应用程序的功能,我想对它进行一些修改,所以开始编辑背景更改,我用google搜索并将代码放在画布上,
Bitmap background = Bitmap.createBitmap( 0, 0, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(background);
c.drawBitmap(background, 10, 010, null);
我尝试了很多东西,但没有任何结果,而且在上面的代码中没有给出drawable的路径,我应该在哪里给出图像的路径? 任何帮助PLZ ..
答案 0 :(得分:0)
希望这段代码能为您提供一些线索...
//Here you can decode it from any source like SD card as i shown,Resources or from assets
Bitmap mBitmapFromSdcard = BitmapFactory.decodeFile("/mnt/sdcard/download/tux.png");
Canvas mCanvas = canvas;
if (mBitmapFromSdcard != null) {
mCanvas.drawBitmap(mBitmapFromSdcard, 0, 0, null);
}