Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.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
Android 如何使用位图更新自定义绘图?_Android_Bitmap_Android Drawable - Fatal编程技术网

Android 如何使用位图更新自定义绘图?

Android 如何使用位图更新自定义绘图?,android,bitmap,android-drawable,Android,Bitmap,Android Drawable,如何使用位图重新绘制已创建的可绘制图形,而不创建新的可绘制图形 用法: Drawable drawable = new MyDrawable(context.getResources(), bitmap); makeSomeAsyncOperation((newBitmap) -> drawable.setBitmap(newBitmap)); MyDrawable.java: class MyDrawable extends BitmapDrawable { public vo

如何使用位图重新绘制已创建的可绘制图形,而不创建新的可绘制图形

用法:

Drawable drawable = new MyDrawable(context.getResources(), bitmap);
makeSomeAsyncOperation((newBitmap) -> drawable.setBitmap(newBitmap));
MyDrawable.java:

class MyDrawable extends BitmapDrawable {
    public void setBitmap(@NonNull Bitmap bitmap) {
        // ???
    }
}
下面是一些具体的实现,其他方式不适合