首页 > 代码库 > Android 将View转换成Bitmap

Android 将View转换成Bitmap

    /** 

     * 将View转换成Bitmap的方法 

     * @param view 

     * @return 

     */  

    public static Bitmap getBitmapFromView(View view) 

    {  

        view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));  

        view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());  

        view.buildDrawingCache();  

        Bitmap bitmap = view.getDrawingCache();  

        return bitmap;  

    }


本文出自 “旦旦家园” 博客,请务必保留此出处http://250215260.blog.51cto.com/9014988/1591278

Android 将View转换成Bitmap