Reputation: 33
Android's imageView has a serious flaw: it makes my image into a square frame, with the rest as white space. How can I fix this? I have tried scale type, but it didn't work. Thank you.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/header"
android:scaleType="fitStart"
android:src="@drawable/img_001" />
</RelativeLayout>
Upvotes: 0
Views: 292
Reputation: 5162
Without your code I can only guess, but I suggest that you add either the xml attribute android:adjustViewBounds="true"
or in your activity, give the imageview that attribute with imageView.setAdjustViewBounds(true)
Upvotes: 1