Android,Java:使用getDrawingCache()提高位图的质量

时间:2014-03-21 13:32:06

标签: java android bitmap android-bitmap drawingcache

我有dialog并将其转换为bitmap。然后我想要发送它与共享意图:

        Bitmap cs = null;
        v1.setDrawingCacheEnabled(true);
        v1.buildDrawingCache(true);
        cs = Bitmap.createBitmap(v1.getDrawingCache());
        Canvas canvas = new Canvas(cs);
        v1.draw(canvas);
        canvas.save();
        v1.setDrawingCacheEnabled(false);
        String path = Images.Media.insertImage(getContext().getContentResolver(), cs, "MyImage", null);
        Uri file = Uri.parse(path);
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("image/png");
        sharingIntent.putExtra(Intent.EXTRA_STREAM, file);
        getContext().startActivity(Intent.createChooser(sharingIntent,"Share image using"));

v1是对话框中TextView的父级(v1是我要发送的内容)。 如果我现在发送位图它的质量非常糟糕。我该如何改进?

0 个答案:

没有答案