在扩展android中的imageview时如何禁用抗锯齿?

时间:2013-07-02 16:55:35

标签: android imageview scaling antialiasing

我有一个像素艺术,我想扩大规模。问题是当我扩展它时,它会得到抗锯齿的所有模糊原因。有没有办法直接从xml中禁用抗锯齿?

1 个答案:

答案 0 :(得分:5)

我希望它有用

Bitmap bmpSource = BitmapFactory.decodeResource(getResources(), SourceFileId);
//100 is dimension to resizing image size
//Passing filter = false will result in a blocky, pixellated image.
//Passing filter = true will give you smoother edges
Bitmap bmpScaled = Bitmap.createScaledBitmap(bmpSource, 100, 100, false); 


ImageView img = (ImageView) findViewById(Your imageView Control Id);
img.setImageBitmap(bmpScaled);

这就是你想要的!?