Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 带循环进度视图的Android Mask ImageView_Java_Android_Android Layout_Porter Duff - Fatal编程技术网

Java 带循环进度视图的Android Mask ImageView

Java 带循环进度视图的Android Mask ImageView,java,android,android-layout,porter-duff,Java,Android,Android Layout,Porter Duff,我正在尝试使用using PorterDuff.Mode.DST_屏蔽imageview,这里是用于屏蔽的示例代码 public static Bitmap getMaskedBitmap(Resources res, int sourceResId,Bitmap mask) { BitmapFactory.Options options = new BitmapFactory.Options(); if (Build.VERSION.SDK_INT >= Build.

我正在尝试使用using PorterDuff.Mode.DST_屏蔽imageview,这里是用于屏蔽的示例代码

 public static Bitmap getMaskedBitmap(Resources res,  int sourceResId,Bitmap mask) {
    BitmapFactory.Options options = new BitmapFactory.Options();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        options.inMutable = true;
    }
    options.inPreferredConfig = Bitmap.Config.ARGB_8888;
    Bitmap source = BitmapFactory.decodeResource(res, sourceResId, options);
    Bitmap bitmap;
    if (source.isMutable()) {
        bitmap = source;
    } else {
        bitmap = source.copy(Bitmap.Config.ARGB_8888, true);
        source.recycle();
    }
    bitmap.setHasAlpha(true);
    Canvas canvas = new Canvas(bitmap);

    Paint paint = new Paint();
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    canvas.drawBitmap(mask, 0, 0, paint);

    mask.recycle();
    return bitmap;
}
source image=将是一个透明的字母“C”,来自像这样的可抽取项

蒙版图像应该来自CircularProgressView。我想使用CircularProgressView蒙版字母C,在点上用纯白填充透明字母“C”(比例为1/10)。可能吗