安卓系统——当使用带有自定义背景的ListView时,如何删除多余的填充



我有以下布局:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:background="#EAEAEA">
  <ListView  
        android:id="@+id/xxx"
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"
        android:textColor="#464C59"         
        android:divider="#A4C539"
        android:dividerHeight="1px">
   </ListView>
    <ImageView
        android:id="@+id/home_bottom_bar"
        android:src="@drawable/bottombar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:clickable="true"/>
</FrameLayout>

目标是在活动的底部设置某种广告栏(其中包含项目列表(。它工作正常,除了一件事!酒吧下面有一些额外的空间(很小,但足够显眼(。顺便说一下,所有的填充都设置为0,那么这个空间从哪里来?

谢谢!

编辑

在调查了这个问题之后,发现自定义背景(#EAEAEA(导致了这个额外的空间。尽管如此,我还是不知道如何解决这个问题。

当你提到它是一个小的额外空间时,它可能是顶部和底部的微小梯度。由ListView创建,当它可滚动时。

你可能读过关于ListView背景的文章,如果它是由这种特殊的梯度引起的,这应该会让你知道如何修复它。

这个渐变线显然也可以被删除:选项卡主机中的额外行

您可能需要使用merge标记,因为每个活动的基本布局都是FrameLayout。(这可能会造成填充。不过我不能百分之百确定(看这里。

最新更新