最近弄安卓项目,遇到用自定义适配器的地方,但是当item数量超过一定数量的时候,RecyclerView的高度也不再增加,尝试取消滑动,设置RecyclerView大小等效果都不是很理想,研究多次后终于找到个方法
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/mRecyclerView2"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
将RecyclerView放在RelativeLayout中即可解决