I use Layout_width="fill_parent
" and Layout_height="wrap content"
. If an image is bigger than the ImageView, it will be downscaled perfectly.
However, I never got it working to upscale smaller images. I tried any combination of ScaleType and "AdjustViewBounds": it always stays in its own size in the middle of the image view. Here is the code...
<LinearLayout android:id="@+id/LinearLayout02" android:layout_height="wrap_content" android:background="@drawable/content_bg" android:orientation="vertical" android:padding="5dp" android:layout_width="fill_parent" android:layout_marginLeft="1px"> <ImageView android:layout_height="wrap_content" android:src="@drawable/test" android:id="@+id/ImageViewTest" android:layout_width="fill_parent" android:adjustViewBounds="true" android:scaleType="center"></ImageView> </LinearLayout>
I just found a way to make it work.
This works in 2.1(AVD) & 4.1.2(device)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitCenter" /> </LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With