Is it possible to display original image in android without fit to device views? -


i have image of size 1000px*1200px , want displayed without being scaled!.

i have searched in stackover flow , google not getting one.

i want full image without scaled, have tried this

step1:-

<imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@drawable/image"                 /> 

step2:-

i have tried scaletype add scaletype imageview

 <imageview     android:scaletype="center"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:src="@drawable/image" /> 

but not working,

in sclate type have tried possible properties (matrix,fitxy this).

is there possibility there doing dispaly original image in android?

plz me on

you can try approach,first image drawable , create bitmap of it.then width , height of bitmap, resize image view , display image in it.it create imageview original image size.

see below code -

bitmapdrawable bitmap = (bitmapdrawable) this.getresources().getdrawable(r.drawable.icon); int bitmapheight= bitmap .getbitmap().getheight(); int bitmapwidth = bitmap .getbitmap().getwidth(); 

now have dimension of original image. re-size image view -

    imageview imageview = (imageview) findviewbyid(r.id.my_image_view);     imageview.getlayoutparams().height = bitmapheight;     imageview.getlayoutparams().width = bitmapwidth; 

and in last step set bitmap image view -

imageview.setimagebitmap(bitmap); 

hope you.

edited

use below code after resize image view -

replace - `imageview.setimagebitmap(bitmap);` 

by

           imageview.setimageresource(r.drawable.icon); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -