<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/article_list_pic"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_300px"/>
<TextView
android:id="@+id/article_list_title"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_100px"
android:below="@id/article_list_pic"
android:maxLines="2"
android:ellipsize="end"
android:textColor="@color/black"/>
</RelativeLayout>
当上面的布局作为RecyclerView的Item时,且父节点为RelativeLayout的时候,各个Item的间距会在滚动一段距离后,越拉越大,发现,将RelativeLayout改为的高度设置为wrap_content就无此现象。另外也可以将android:below="@id/article_list_pic"去掉,然后改为LineanrLayout