你怎么知道的Andr​​oid不按比例的图像? [英] How do you tell Android not to scale images?

查看:111
本文介绍了你怎么知道的Andr​​oid不按比例的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在/绘制文件夹,我的理解是PTED为/绘制-MDPI INTE $ P $一些照片。现在,当被使用(具体取决于设备),这些图像缩放。我不希望添加更多的图片,因为它们不存在。而且我没有创建不同的资源图片资源。

I have some pictures in the /drawable folder, which to my understanding is intepreted as /drawable-mdpi. Now these images are scaled when being used (depending on the device). I don't want to add more pictures, because they don't exist. And I don't have the resources to create different res pictures.

我只是想要的图片出现在较小的大的设备。请问有没有缩放图像的方式?

我讨厌不得不硬code中所有的画面尺寸。

I'd hate to have to hard-code all the picture sizes.

这是第二个问题,编辑不会引起人们的注意的。我们对此深感抱歉。

推荐答案

添加BitmapFactory.Options参数去codeResource的标志inScaled设置为false是如何做到这一点。

Adding the BitmapFactory.Options parameter to the decodeResource with the flag inScaled set to false is how to do it

BitmapFactory.Options mNoScale = new BitmapFactory.Options();
mNoScale.inScaled = false;
BitmapFactory.decodeResource(getResources(), R.drawable.id, mNoScale);

这篇关于你怎么知道的Andr​​oid不按比例的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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