Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested recyclerview #12

Open
alexchaoss opened this issue Aug 13, 2021 · 0 comments
Open

Nested recyclerview #12

alexchaoss opened this issue Aug 13, 2021 · 0 comments

Comments

@alexchaoss
Copy link

alexchaoss commented Aug 13, 2021

Hi, I've been having trouble trying to add a recyclerview inside the expandable content layout.

If I have normal views it works fine, however when I add a recyclerview, it doesn't recalculate the size of the expandable view and it ends up cutting off other views inside.

Here is my code for the expandable layout, the part that doesn't work is the recyclerTeam1 and recyclerTeam2:

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="wrap_content"
    android:layout_marginBottom="10dp"
    app:cardCornerRadius="8dp"
    app:cardElevation="5dp"
    android:orientation="vertical">

    <com.robertlevonyan.views.expandable.Expandable
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:exp_animateExpand="true"
        app:exp_backgroundColor="#21242d">

        <LinearLayout
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_gravity="center"
            android:layout_marginStart="10dp"
            android:weightSum="3">

            <TextView
                android:id="@+id/date"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1.1"
                android:gravity="center"
                android:textAlignment="center"
                android:textColor="#FFF"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/type"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.7"
                android:gravity="center"
                android:textAlignment="center"
                android:textColor="#FFF"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/map"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1.2"
                android:gravity="center"
                android:textAlignment="center"
                android:textColor="#FFF"
                android:textSize="14sp" />
        </LinearLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#32353e"
            android:orientation="vertical">
            
            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:textAlignment="center"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:textColor="#FFF"
                android:textSize="14sp"
                android:text="Teams"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toTopOf="@id/teams"
                />

            <LinearLayout
                android:id="@+id/teams"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:layout_weight="2"
                android:orientation="horizontal"
                app:layout_constraintTop_toBottomOf="@+id/title"
                app:layout_constraintBottom_toTopOf="@id/recyclers">

                <TextView
                    android:id="@+id/team1"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:layout_weight="1"
                    android:textAlignment="center"
                    android:textColor="#FFF"
                    android:textSize="14sp" />

                <TextView
                    android:id="@+id/team2"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:textAlignment="center"
                    android:textColor="#FFF"
                    android:textSize="14sp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/recyclers"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:orientation="horizontal"
                app:layout_constraintTop_toBottomOf="@id/teams"
                app:layout_constraintBottom_toBottomOf="parent">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recyclerTeam1"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_gravity="center"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    android:padding="5dp" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recyclerTeam2"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_gravity="center"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    android:padding="5dp" />
            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>

    </com.robertlevonyan.views.expandable.Expandable>

</androidx.cardview.widget.CardView>

Here are some screenshots:

No recyclerviews:
228807469_5835224823216312_3020479327798093259_n

With recyclerviews:
229394309_585542399497455_5588224295292134955_n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant