删除应用程序边框和列表视图之间的空间

时间:2015-05-23 15:14:08

标签: android android-listview

我正在开发一个使用android studio的列表视图的Android应用程序。但是当我使用它时,列表视图和app边界之间会显示一个空间。我可以删除那个空间吗?就像在这张图片中我需要设计我的应用程序。以下代码是我在编辑器中获得的listview的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" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentBottom="true" />
</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

填充是由于提供给RelativeLayout

的填充

从您的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=".MainActivity">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/listView"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

</RelativeLayout>