Reputation: 89
I have an ImageView inside a TableRow which needs to basically display the image by maintaining its aspect ratio. However this is what I end up with:
Here's my XML for the TableLayout and that specific row only:
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:padding="5dip" >
<ImageView
android:id="@+id/producImagScroller"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@drawable/girl2" >
</ImageView>
</TableRow>
What do you think is wrong?
EDIT: After trying Greg Ennis's answer:
Upvotes: 0
Views: 188
Reputation: 15379
Instead of this
android:background="@drawable/girl2"
You should set
android:src="@drawable/girl2"
After doing this, try adjusting the image scaleType
attribute. (Works only if you change background
to src
).
Upvotes: 1