本文整理汇总了Java中android.support.graphics.drawable.VectorDrawableCompat.draw方法的典型用法代码示例。如果您正苦于以下问题:Java VectorDrawableCompat.draw方法的具体用法?Java VectorDrawableCompat.draw怎么用?Java VectorDrawableCompat.draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.graphics.drawable.VectorDrawableCompat
的用法示例。
在下文中一共展示了VectorDrawableCompat.draw方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
private static Bitmap getBitmap(VectorDrawableCompat vectorDrawable) {
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
vectorDrawable.draw(canvas);
return bitmap;
}
示例2: getVector2Bitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
public static Bitmap getVector2Bitmap(Context context, int id) {
VectorDrawableCompat vectorDrawable = VectorDrawableCompat.create(context.getResources(), id, context.getTheme());
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
vectorDrawable.draw(canvas);
return bitmap;
}
示例3: getBitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
private static Bitmap getBitmap(VectorDrawableCompat vectorDrawable, int width, int height) {
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
vectorDrawable.draw(canvas);
return bitmap;
}
示例4: getBitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
private Bitmap getBitmap(int resource) {
VectorDrawableCompat drawable = VectorDrawableCompat.create(mContext.getResources(), resource, null);
if (drawable != null) {
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} else {
return null;
}
}
示例5: createBitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
private static Bitmap createBitmap(VectorDrawableCompat vectorDrawable) {
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
vectorDrawable.draw(canvas);
return bitmap;
}
示例6: getBitmap
import android.support.graphics.drawable.VectorDrawableCompat; //导入方法依赖的package包/类
private static Bitmap getBitmap(Context context, int resource) {
VectorDrawableCompat drawable = VectorDrawableCompat.create(context.getResources(), resource, null);
if (drawable != null) {
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} else {
return null;
}
}