15

There is something weird about this ImageView, after big image scaled down there is still "free space".

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/bb"
    android:scaleType="fitStart" />
<TextView
    android:id="@+id/textMainBoxTitle"
    android:text="some text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1" />
</LinearLayout>

Some screens:

Eclipse:
eclipse http://img560.imageshack.us/img560/6218/eclipse.png

simulator:
simulator http://img600.imageshack.us/img600/3023/simulator.png

And the original image:
original
(source: janissary.eu)

Why am'I getting space after image?

Community
  • 1
  • 1
Mikooos
  • 5,360
  • 5
  • 31
  • 45

2 Answers2

45

I found solution: How to scale an Image in ImageView to keep the aspect ratio

Gratzi wrote about android:adjustViewBounds="true" which fixes the isue.

Community
  • 1
  • 1
Mikooos
  • 5,360
  • 5
  • 31
  • 45
0

Do you have the java code? It could be an issue with fillparent, wrapcontent. I don't know how you've laid out the TextView and ImageView. Or, off the top of my head, the image file could have an invisible lower part. I've done similar mistakes before, when making image files.

  • The image is fine. If I change fitstart to fitend the image would be drawn at the bottom and the black space would be at the top. There is no problem in java I think. It's included to main.xml and filled horizontally and wrapped vertically. – Mikooos Nov 06 '10 at 16:01