0

I have been doing a nested recyclerView lately, and thanks to this post I managed to solve the problem. But why my main background is wrap content to the custom layout instead of match parent?

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFC18D"
android:id="@+id/fLayout">
<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    card_view:cardElevation="2dp"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="3dp">
    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:id="@+id/llTextHolder">
        <TextView
            android:text="Title"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:textColor="#000000"
            android:id="@+id/tvCardHeader"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="5dp" />
        <android.support.v7.widget.RecyclerView
            android:id="@+id/takwimRecyclerViewList"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</android.support.v7.widget.CardView>

And here is the screenshot.

enter image description here

Any ideas why is the happening?

Community
  • 1
  • 1
user3057414
  • 41
  • 1
  • 9

1 Answers1

0

wrapcontent means it will wrap the content according to its size i.e it will shrink or expand according. matchparent will match the parent regardless of its size and will not look good.