Convert View To Bitmap

2017-04-12  本文已影响56人  Yang_Bob
public static Bitmap convertViewToBitmap(View view) {
    view.destroyDrawingCache();
    view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.setDrawingCacheEnabled(true);
    return view.getDrawingCache(true);
}

原文链接:http://www.angeldevil.me/2014/07/22/Convert-View-To-Bitmap/

上一篇下一篇

猜你喜欢

热点阅读