I have to implementing
a RecylerView
,it should wrap the content if its contain only item content height is less. If the item's increase like 250dp
, it should be set to max heght(250dp)
and that be able to scroll.How to achieve this.my parent layout is a Relative layout
.
This is My Layout file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom" />
</RelativeLayout>
Screen Shot if its only one item.This should be wrap_content.