Android的:不能删除的LinearLayout图像之间的垂直间隙间隙、图像、Android、LinearLayout

2023-09-04 11:01:10 作者:乐原

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

I have a simple LinearLayout in Android with two images vertically:

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

正如你可以在下面的链接看到,我不能在顶部,并在图像的底部摆脱AA差距: http://img185.imageshack.us/img185/8484/senzanomev.png

As you can see at the following link, I can't get rid of a a gap at the top and at the bottom of the images: http://img185.imageshack.us/img185/8484/senzanomev.png

我已经竭尽所能想象的的LinearLayout和ImageViews,即:

I've tried everything imaginable on the LinearLayout and the ImageViews, i.e.:

android:padding="0px"
android:top="0px"
android:bottom="0px"
android:top="0px"
android:layout_margin="0px"

没有成功。 我能做些什么来消除这些空白边框?

with no success. What can I do to remove these empty borders?

推荐答案

我找到了解决办法。我需要这个属性添加到的ImageView

I found the solution. I needed to add this attribute to the ImageView:

android:adjustViewBounds="true"
 
精彩推荐