Android的:不能删除的LinearLayout图像之间的垂直间隙 [英] Android: can't remove vertical gap between images in LinearLayout

查看:813
本文介绍了Android的:不能删除的LinearLayout图像之间的垂直间隙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的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差距: <一href="http://img185.imageshack.us/img185/8484/senzanomev.png">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"

这篇关于Android的:不能删除的LinearLayout图像之间的垂直间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆