I have the following code to load png files:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inDither = false;
map = BitmapFactory.decodeResource(getResources(), mapid, options);
Unfortunately it loads images as RGB_565 if they have no alpha channel. How can I prevent this and consistently load them every time unchanged (no dithering, no conversion, or anything else) ?
If this is not possible then is there maybe another way to load PNG files as ARGB_8888 without BitmapFactory ?
Or is there maybe another format that can be used instead of PNG that also supports an Alpha channel and always delivers ARGB_8888 bitmaps ?
PS: I am using Android 2.3.4.
I got an idea.
I think it should run.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.