Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.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 在drawable文件夹中修改PNG图像_Android_Android Drawable - Fatal编程技术网

Android 在drawable文件夹中修改PNG图像

Android 在drawable文件夹中修改PNG图像,android,android-drawable,Android,Android Drawable,我的可绘制文件夹中有一个PNG文件。 我需要修改它合并在一个更小的图像。 我使用此代码创建一个新位图 Bitmap bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.i10); Bitmap smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.i11); Bitmap result = Bitmap.creat

我的可绘制文件夹中有一个PNG文件。 我需要修改它合并在一个更小的图像。 我使用此代码创建一个新位图

Bitmap bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.i10);
Bitmap smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.i11);

        Bitmap result = Bitmap.createBitmap(bigImage.getWidth(), bigImage.getHeight(), bigImage.getConfig());
        Canvas canvas = new Canvas(result);

        canvas.drawBitmap(bigImage, 0f, 0f, null);
        canvas.drawBitmap(smallImage, 10, 10, null);

我错过的是最后一部分。将新位图bigImage分配给R.drawable.i10

资源是静态的,在应用程序Apk中提供这些文件后,您无法更改它们


但是,您可以创建/操作现有文件并将其另存为存储中的新文件,但这是另一回事&与问题无关

好的,我现在明白了。谢谢