【发布时间】:2014-04-15 15:03:20
【问题描述】:
我在 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>
正如您在以下链接中看到的那样,我无法消除图像顶部和底部的间隙: 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"
没有成功。 我该怎么做才能删除这些空白边框?
【问题讨论】:
-
您是否尝试过 layout_marginTop 的负值?
-
哎呀,刚刚编辑了我的评论:它确实有效,但我不确定要设置哪个值(以 dp 为单位)。我应该尝试直到它们对齐吗?
-
我遇到了类似的问题,我不得不尝试直到找到合适的值。如果有人可以提出更好的方法 - 非常欢迎!
标签: android imageview android-linearlayout