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
i want display imageview fits width of device. (fit width only)
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
Post a Comment