Android - Display image to fit width of device -


i developing android app thap show photos in listview. layout each item in listview.

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="wrap_content">     <imageview         android:id="@+id/exam_page_item_imageview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:scaletype="centercrop"/> </relativelayout> 

my listview displays

enter image description here

i want display imageview fits width of device. (fit width only)

enter image description here

could give me suggestion or have idea resolve problem ?

try :

<imageview android:id="@id/imgview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustviewbounds="true" android:scaletype="fitcenter" />   android:adjustviewbounds = "true" 

will when images larger imageview. not strech image shrink it.

android:scaletype="fitcenter" 

for times when image smaller imageview, strech image width of parent.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -