Unable to disable anti-aliasing in Android

I am new to Android and I have finished a game designed to create pixel art. I was going to scale my images (images and bitmaps made on canvas) from small pixel PNG files. The thing is, I could not turn off anti-aliasing of any method I tried. The image has always been blurry. All my images are in the same drawable folder. I tried android: antialias = "false" in ImageView in xml.

I tried the method described here: http://www.41post.com/4241/programming/android-disabling-anti-aliasing-for-pixel-art \ I tried to change the paint (paint.setAntiAlias ​​(false)) when drawing a bitmap to the canvas.

And even tried to associate ImageView with xml bitmap using antialias = "false"

Am I missing something? In the end, I just had to decide that some images are blurry and have large images as large images and do not change in the XML file.

+1
source share
1 answer

From the Hardware Acceleration Guide , it looks like this: Paint#setFilterBitmap() always on and cannot be turned off when hardware acceleration is turned on. Try checking if your application uses hardware acceleration.

I saw a similar behavior in the emulator when the "Use the main GPU" option was turned on and found that a device that does not have anti-aliasing behavior may be forced to have this behavior using Paint#setFilterBitmap(true) . I could not disable the behavior in the emulator, but without disabling the host GPU option.

+1
source

All Articles