ImageView后的空白

时间:2010-11-05 15:53:18

标签: android android-layout

对于这个ImageView有一些奇怪的东西,在缩小大图像之后仍有“自由空间”。

<?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>

有些屏幕:

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

模拟器
simulator http://img600.imageshack.us/img600/3023/simulator.png

原始图像:
original http://www.janissary.eu/img/obraz.jpg

为什么我会在影像之后获得空间?

2 个答案:

答案 0 :(得分:43)

我找到了解决方案: How to scale an Image in ImageView to keep the aspect ratio

Gratzi写了关于android:adjustViewBounds =“true”的文章来解决这个问题。

答案 1 :(得分:0)

你有java代码吗? 这可能是fillparent,wrapcontent的一个问题。我不知道你是如何布局TextView和ImageView的。 或者,在我的头顶,图像文件可能有一个看不见的下半部分。在制作图像文件之前,我做过类似的错误。

相关问题