第一步:包装一层RelativeLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/cash_coupon_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/distance_size_4"
android:paddingTop="@dimen/distance_size_4"
android:visibility="visible" />
</RelativeLayout>
第二步:Adapter的布局的最外层布局保证 android:layout_height="wrap_content"是wrap_content属性
好用请收藏