在Android的ImageView的图像避免了scalling如HTML图像映射 [英] Android avoid image scalling in Imageview for Image Mapping like Html

查看:172
本文介绍了在Android的ImageView的图像避免了scalling如HTML图像映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜想实现图像映射像android系统中的HTML。对于我这种被称为项目。它的工作很好,当我访问从绘制-nodpi 文件夹中的图像。但是,当我从其他的绘制文件夹的映像访问得到的缩放按android的概念。在这里,我用绘制文件夹,只检查目的。其实我从后端服务形象。

Hi Am trying to implement image mapping as like html in android. For that i referred this project. Its work good when i access the image from drawable-nodpi folder. But when i access from other drawable folder the image get scaled as per the android concepts. Here i used drawable folder for checking purpose only. Actually i get image from back end service.

我也通过设置在无密度试图用位图

I also tried with bitmap by setting the no density.

Bitmap bm;
bm=BitmapFactory.decodeResource(getResources(), R.drawable.blueprint);
bm.setDensity(Bitmap.DENSITY_NONE);
mImageMap.setImageBitmap(bm); //mImageMap is customized view which extends Imageview

但它不工作。我也尝试按本帖子。它不是working.Is有什么办法来加载图像图像视图不进行缩放?
在这里输入的形象描述

But it's not working. Am also tried as per this post. Its not working.Is there any way to load image to image view without scaling?

推荐答案

您可以使用 Bitmap.createScaledBitmap 通过图片的一部开拓创新mesaures ..

you can use Bitmap.createScaledBitmap with the orignal mesaures of the picture..

int width = orignal bitmap width
int height = orignal bitmap height
Bitmap bm;
bm = getBitmap... from network
bm = Bitmap.createScaledBitmap(bm,width,height,true);

这将创建正确缩放图像一个,只是将其放置在ImageView的。

this will create a image scaled properly and just place it in the ImageView.

这篇关于在Android的ImageView的图像避免了scalling如HTML图像映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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