其实我从资产文件夹中打开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加快位图的开幕式将是受欢迎的
感谢