Android: How to resize image to fill parent? -


i working on application shows images, , need create view shows big images in 1:1 aspect ratio.

first, have thumbnails @ 72x72 resolution. have put them in imageview if add parameters android:width="fill_parent" , android:height="wrap_content", image not not size of imageview centered in mid.

i tried adding parameter android:scaletype="centercrop" resized image horizontally height remained same.

how set imageview on devices width parent view , should height.

i can programatically, need able in xml.

my xml file:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical">      // imageview talking above     <imageview         android:id="@+id/invitation_imageview"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_margin="1dp"         android:scaletype="centercrop"         android:src="@drawable/face_woman_smile" />      <imageview         android:id="@+id/invitation_avatar_view_1"         android:layout_width="wrap_content"         android:layout_height="40dp"         android:src="@drawable/face_woman_smile"         android:scaletype="center"         android:layout_margin="1dp" />  </linearlayout> 

i think need add imageview

android:adjustviewbounds="true" 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -