I am having problems grouping PNG files. Digging into a problem led to two solutions. Both make sense individually, but together they do not. The solutions I discovered are:
1) Move the PNG file to the "raw" folder. This prevents the AAPT from “optimizing” the image, resulting in strapping.
2) Change the pixel format of your Activity window to RGBA_8888 (that is, in onCreate add this line "getWindow (). SetFormat (PixelFormat.RGBA_8888)"). On Android 2.2 and below, the default pixel format is 16 bits (565).
I tried both of them and they fix the grouping effect in my images, however now I am even more confused about what Android does.
On the one hand, if I leave my PNG in a folder with the ability to draw, it will be "optimized", which will lead to the effect of stripes in the image. This magic disappears when I change the pixel format to 32-bit. If the image were “optimized,” I would expect the strip to remain.
On the other hand, if I moved PNG to an unprocessed folder, it will retain a good gradient and display fine even if the pixel format is presumably 16-bit.
If anyone knows what is going on, I would appreciate it.
Thanks,
Dan
android png
Dan
source share