我想2個圖像合併,所以我搜查,看到了一個代碼在這裏snipplet combining two png files in androidBitmapFactory.decodeFile不能在一類解決
Bitmap bottomImage = new BitmapFactory.decodeFile("myFirstPNG.png");
Bitmap topImage = new BitmapFactor.decodeFile("myOtherPNG.png");
Canvas comboImage = new Canvas(bottomImage);
// Then draw the second on top of that
comboImage.drawBitmap(topImage, 0f, 0f, null);
// bottomImage is now a composite of the two.
// To write the file out to the SDCard:
OutputStream os = null;
try {
os = new FileOutputStream("/sdcard/DCIM/Camera/" + "myNewFileName.png");
image.compress(CompressFormat.PNG, 50, os)
} catch(IOException e) {
e.printStackTrace();
}
我試圖使用它,但出於某種原因位圖底圖=新的BitmapFactory.decodeFile(「myFirstPNG.png」);是給錯誤BitmapFactory不能resovlved成類型,但我已經有兩個
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
我使用PhoneGap的,我把這個在主要活動,以測試
刪除位圖中的「新」bottomImage = new BitmapFactory.decodeFile(「myFirstPNG.png」); 位圖topImage = new BitmapFactor.decodeFile(「myOtherPNG.png」); – Pragnani 2013-02-22 05:50:55