其實我從資產文件夾中打開PNG文件與此代碼:如何用RGB_565創建位圖?
public static Bitmap loadImage(String imageName){
if(imageName.charAt(0) == '/') {
imageName = imageName.substring(1);
}
imageName = imageName + ".png";
Bitmap image = BitmapFactory.decodeStream(getResourceAsStream(imageName));
return image;
}
public static InputStream getResourceAsStream(String resourceName) {
if(resourceName.charAt(0) == '/') {
resourceName = resourceName.substring(1);
}
InputStream is = null;
try {
is = context.getAssets().open(resourceName);
} catch (IOException e) {e.printStackTrace();}
return is;
}
這段代碼打開了位圖全cuality,它需要大量的時間來打開它。我將嘗試使用RGB_565來加速位圖的打開。
我該如何改變我的代碼來打開RGB_565位圖?正如你所看到的,我不知道圖像的寬度和高度。
而且任何sugerences加快位圖的開幕式將是受歡迎的
感謝