Android avoid image scalling in Imageview for Image Mapping like Html

203 views Asked by At

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

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? IMAGE_FROM_drawable-nodpienter image description here

1

There are 1 answers

3
Itzik Samara On BEST ANSWER

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

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