2

I'm developing an Android 2.2 application for multiple devices and I have a problem with an image.

This is my layout:

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/layout_empty"
            android:src="@drawable/faqs" />

    </ScrollView>

And this is what I see on my tablet device:

enter image description here

It looks perfect on my HTC Desire.

What is wrong?

Community
  • 1
  • 1
VansFannel
  • 45,055
  • 107
  • 359
  • 626

2 Answers2

8

add android:scaleType="fitXY" to your ImageView

K_Anas
  • 31,226
  • 9
  • 68
  • 81
  • Excellent. Now, just in order to understand, wouldn't be the function of this line? `android:layout_width="match_parent"` – Soph Nov 18 '14 at 19:42
  • But it didn't keep aspect ratio. Even with android:adjustViewBounds="true" parameter! – Dr.jacky Nov 20 '16 at 16:07
1

See the accepted answer here. Need to set the layout_height of the image view to fill_parent

Community
  • 1
  • 1
Luke
  • 1,069
  • 18
  • 28