java android - why images are distorted? -


just try - put on layout imageview anypngyouwant.png , make bitmap.xml

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"      android:src="@drawable/anypngyouwant"  /> 

and put in on same layout..

why different size? i've tried many different images , still in bitmal.xml size of wrap_content differes source png. want them same

layout :

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"      tools:context=".mainactivity" >      <imageview         android:id="@+id/imageview1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_alignparenttop="true"         android:src="@drawable/anypngyouwant" />      <imageview         android:id="@+id/imageview2"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentleft="true"         android:layout_below="@+id/imageview1"         android:src="@drawable/bitmap" />  </relativelayout> 

check method, gets bitmap object of image file , sets on imageview:

file ifile = new  file(“path/anypngyouwant.png”); if(ifile.exists()){      bitmap bmp = bitmapfactory.decodefile(ifile.getabsolutepath());      imageview iv = (imageview) findviewbyid(r.id.imageview1);     iv.setimagebitmap(bmp);  } 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -