1

ビューではなく画像としてSurfaceViewを使用してキャンバスの描画を保存する方法。

4

1 に答える 1

2

以下のコードを試してみてください

    Bitmap bitmap = Bitmap.createBitmap(mSurfaceView.getWidth(), mSurfaceView.getHeight(), Bitmap.Config.ARGB_8888);
mSurfaceView.draw(new Canvas(bitmap));
try {
    OutputStream out = new BufferedOutputStream(new FileOutputStream(saved.png));
    bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (IOException e) {
    Log.w(TAG, e);
}
于 2012-04-10T12:21:32.953 に答える