Skip to content

Commit

Permalink
creating a copy of drawing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Viven committed Nov 28, 2016
1 parent 6bef663 commit 9583348
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Build;
Expand Down Expand Up @@ -63,7 +64,10 @@ public boolean onDispatchTouchEvent(MotionEvent ev) {
imageView = new ImageView(view.getContext());
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
imageView.setImageBitmap(view.getDrawingCache());
Bitmap drawingCache = view.getDrawingCache();
imageView.setImageBitmap(drawingCache.copy(drawingCache.getConfig(), true));
view.destroyDrawingCache();

FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
view.getWidth(), view.getHeight());
frameLayout.addView(imageView, layoutParams);
Expand Down

0 comments on commit 9583348

Please sign in to comment.