Why does not my recycleview respect Match Parent?

0

I have a cordinatorlayout that contains a recycleview, but it fills the whole screen, and everything is set to match_parent, including the recycleview card XML:

<android.support.design.widget.CoordinatorLayoutxmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="false"
            app:layout_scrollFlags="scroll|enterAlways">

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <com.nex3z.togglebuttongroup.SingleSelectToggleGroup
                    android:id="@+id/group_choices"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="4dp"
                    app:layout_collapseMode="pin"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:tbgCheckedButton="@+id/tudo">

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/tudo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dp"
                        android:text="Tudo"
                        app:tbgMarkerColor="@color/colorPrimary" />

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/unidade"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dp"
                        android:text="Praia da Costa"
                        app:tbgMarkerColor="@color/colorPrimary" />
                </com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
            </android.support.constraint.ConstraintLayout>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_noticias"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>
    
asked by anonymous 10.01.2018 / 19:34

1 answer

0

Involve your RecyclerView into a Layout (FrameLayout, for example). This layout should also have android:layout_width="match_parent"

Move app:layout_behavior="@string/appbar_scrolling_view_behavior" to this FrameLayout

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fitsSystemWindows="false"
            app:layout_scrollFlags="scroll|enterAlways">

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <com.nex3z.togglebuttongroup.SingleSelectToggleGroup
                    android:id="@+id/group_choices"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="4dp"
                    app:layout_collapseMode="pin"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:tbgCheckedButton="@+id/tudo">

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/tudo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dp"
                        android:text="Tudo"
                        app:tbgMarkerColor="@color/colorPrimary" />

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/unidade"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="2dp"
                        android:text="Praia da Costa"
                        app:tbgMarkerColor="@color/colorPrimary" />

                </com.nex3z.togglebuttongroup.SingleSelectToggleGroup>

            </android.support.constraint.ConstraintLayout>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

       <android.support.v7.widget.RecyclerView
          android:id="@+id/rv_noticias"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />

    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>
    
05.02.2018 / 20:49