Home > Net >  'image-rendering: pixelated;' like on ImageView?
'image-rendering: pixelated;' like on ImageView?

Time:11-29

With CSS you can add style to img tag with 'image-rendering: pixelated;'.

Is there a way to do it in Android with similar effect?

CodePudding user response:

You can make it (turning anti-aliasing off) by setting setFilterBitmap(false) to Drawable object (or Paint object when using Canvas).

Drawable drawable = getDrawable(R.drawable.sample);
drawable.setFilterBitmap(false);

ImageView imageView = findViewById(R.id.imageView);
imageView.setImageDrawable(drawable);
  • Related