使用 CSS,您可以使用“image-rendering: pixelated;”為 img 標籤添加樣式。
有沒有辦法在Android中做到類似的效果?
您可以通過設置setFilterBitmap(false)
為Drawable
對象(或Paint
使用 時的對象)來實現(關閉抗鋸齒Canvas
)。
Drawable drawable = getDrawable(R.drawable.sample);
drawable.setFilterBitmap(false);
ImageView imageView = findViewById(R.id.imageView);
imageView.setImageDrawable(drawable);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句