I've stumped in a problem I can't solve. I've got a fragment with a CardView containing a RecyclerView. This RecyclerView has layout_height="wrap_content" but i can see this is not working. I've read some solutions here saying that in version 23.2 of the support library this is fixed, but it doesn't work in my case. Also, i want a TextView right below the CardView, but it is not showing it. It's working fine if i give the CardView a fixed height.
I hope someone could help with this.
EDIT Let's see if this image explains better what i mean.
Here,the RecyclerView limits are the blue rectangle, while they should be similar to the red one, that is what i want to archieve.
build.gradle
dependencies{
compile 'com.android.support:recyclerview-v7:24.+'
}
layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:padding="5dp"
card_view:cardElevation="4dp">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.v7.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="300dp"
android:text="test text"
android:textSize="20sp"/>
