替换ViewUtils.fromView实现
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -85,6 +85,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -20,11 +20,12 @@ public class ViewUtils {
|
||||
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());
|
||||
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas( bitmap );
|
||||
view.draw( canvas );
|
||||
return bitmap;
|
||||
// return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
|
||||
// Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
// Canvas canvas = new Canvas( bitmap );
|
||||
// view.draw( canvas );
|
||||
// return bitmap;
|
||||
Bitmap bitmap = null;
|
||||
return (bitmap = view.getDrawingCache()) != null ? bitmap.copy(Bitmap.Config.ARGB_8888, false) : null;
|
||||
}
|
||||
|
||||
public static void processChildView(View view) {
|
||||
|
||||
Reference in New Issue
Block a user