android listview适合屏幕
上面的代码列表视图在拐角处有一些空间。我需要设置我的列表视图以适应屏幕。有人能给出您正在使用的解决方案吗android listview适合屏幕,android,Android,上面的代码列表视图在拐角处有一些空间。我需要设置我的列表视图以适应屏幕。有人能给出您正在使用的解决方案吗 <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe" android:layout_width="match_parent" android:layou
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_alignParentEnd="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:ignore="InconsistentLayout">
<ListView
android:id="@+id/contacts_list"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_above="@+id/footer"
android:layout_alignParentTop="true">
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
这使得layour wrapping listview将具有边距,因此要修复边距,只需将其设置为0:
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
只需卸下衬垫即可
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_alignParentEnd="true"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:ignore="InconsistentLayout">
<ListView
android:id="@+id/contacts_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/footer"
android:layout_alignParentTop="true">
</ListView>
尝试从您的SwipeRefreshLayout
中删除填充。但我需要SwipeRefreshLayout不要删除swiperefresh布局。而是从中删除填充。您的高度为零?正如我看到的android:layout_height=“0dp”hi;移除填充对您有效吗?如果没有,请尝试查看SwipeRefreshLayout的父级是否没有填充或边距,祝您好运
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_alignParentEnd="true"
tools:ignore="InconsistentLayout">
<ListView
android:id="@+id/contacts_list"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_above="@+id/footer"
android:layout_alignParentTop="true">
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>