android - 两个页脚之间有空格

时间:2015-03-04 08:25:55

标签: android header footer spacing

我创造了两个独立的页脚,但即使只有一个问题仍然存在问题。页脚的顶部和底部有一个白色空间。图像本身是完美的,并且没有空白区域。它们应该完全没有间距地堆叠在一起。

以下是截图: https://www.dropbox.com/s/403iht0fgp25s49/Screenshot%202015-03-04%2010.19.09.png?dl=0

为了使它们之间没有白色间距我该怎么办?

谢谢

这是我的xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapFragment" >

  <!-- Footer aligned to bottom -->

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:gravity="center"
      >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView_footer_booktestdrive"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/bookatestdrivefooter" />

        <ImageView
            android:id="@+id/imageView_footer_website"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/footer" />

    </LinearLayout>

</RelativeLayout>



 <RelativeLayout
        android:id="@+id/content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/footer"
        android:gravity="center" >

     <ImageView
         android:id="@+id/imageView1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:src="@drawable/map1" />

    </RelativeLayout>

1 个答案:

答案 0 :(得分:0)

我已经编辑了你的布局: 删除linearlayout并对齐一个图片bottom

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MapFragment" >

    <!-- Footer aligned to bottom -->

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:id="@+id/footer"
    android:orientation="vertical">

        <ImageView
            android:id="@+id/imageView_footer_booktestdrive"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="fitXY"
            android:src="@drawable/bookatestdrivefooter"
            />

        <ImageView
            android:id="@+id/imageView_footer_website"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="fitXY"
            android:src="@drawable/footer"
            />
    </LinearLayout>   

    <RelativeLayout
        android:id="@+id/content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/footer"
        android:gravity="center" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:src="@drawable/map1" />

    </RelativeLayout>
</RelativeLayout>

告诉我们它是否有效。