如何扩大在一个机器人时的ImageView禁用抗锯齿? [英] How to disable anti-aliasing when scaling up an imageview in android?

查看:296
本文介绍了如何扩大在一个机器人时的ImageView禁用抗锯齿?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想要扩展一个像素艺术。问题是,当我称它,它得到抗混叠的所有模糊的原因。有没有一种方法来禁用直接从XML抗锯齿?

I have a pixel art that I want to scale up. The problem is when I scale it up, it gets all blurred cause of the antialiasing. Is there a way to disable antialiasing directly from xml?

推荐答案

我希望它有用

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);

是这款U想要什么!?

is this what u want!?

这篇关于如何扩大在一个机器人时的ImageView禁用抗锯齿?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆