I would like to display an image with a frame. The solution below is great for some images, but not for others.
So far, I believe that it works great for small images, but not for large ones.
With a smaller image, the solution displays the image beautifully with a 2-pixel border. With a large pattern, the background is too wide in height.
I tested this with an image that I manually scaled from 2000 * 400 to 200 * 40. Thus, it was the same image, only preliminary.
Any idea why large photos won't scale the same as small ones?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center" >
<ImageView
android:id="@+id/testimage"
android:background="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/testimage2"
android:padding="2dip"
android:scaleType="fitCenter"
/>
</LinearLayout>
source
share