Android:无法消除LinearLayout中图像之间的垂直间隙

Enr*_*oma 23 android imageview android-linearlayout

我在Android中有一个简单的LinearLayout,它有两个垂直图像:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.eataly.android" 
    android:orientation="vertical"
    android:background="@android:color/white"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/img_header1"
        />

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/img_header2"
        />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

正如您在以下链接中看到的,我无法摆脱图像顶部和底部的间隙:http: //img185.imageshack.us/img185/8484/senzanomev.png

我已经尝试了LinearLayout和ImageViews上可以想象到的一切,即:

android:padding="0px"
android:top="0px"
android:bottom="0px"
android:top="0px"
android:layout_margin="0px"
Run Code Online (Sandbox Code Playgroud)

没有成功.我该怎么做才能删除这些空边框?

Enr*_*oma 66

我找到了解决方案.我需要将此属性添加到ImageView:

android:adjustViewBounds="true"
Run Code Online (Sandbox Code Playgroud)