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

Problem in showing list of tables in Recyclerview #170

Open
yubarajoli77 opened this issue Dec 6, 2018 · 3 comments
Open

Problem in showing list of tables in Recyclerview #170

yubarajoli77 opened this issue Dec 6, 2018 · 3 comments

Comments

@yubarajoli77
Copy link

I tried to show the list of tables in recycler view using custom design for row, all goes fine but table only show 4 rows including header i.e all rows are not included when I use layout_height to match_parent. But they are visible when I give static value like 200dp. How to include my all dynamic rows no matter how many rows are there.
Here is my custom row layout

<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">

<android.support.v7.widget.CardView
    android:id="@+id/cv_routine_holder"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="4dp"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:layout_marginStart="4dp"
    android:layout_marginTop="4dp"
    app:cardCornerRadius="10dp"
    app:cardBackgroundColor="@color/colorWhite"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/cl_routine_card_holder"
        android:padding="2dp">

        <TextView
            android:id="@+id/tv_routine_course_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="108dp"
            android:layout_marginLeft="108dp"
            android:layout_marginTop="8dp"
            android:padding="4dp"
            android:text="Course:"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tv_routine_course"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:padding="4dp"
            android:text="CSIT"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.05"
            app:layout_constraintStart_toEndOf="@+id/tv_routine_course_label"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tv_routine_semester_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="96dp"
            android:layout_marginLeft="96dp"
            android:padding="4dp"
            android:text="Semester:"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tv_routine_course_label" />

        <TextView
            android:id="@+id/tv_routine_semester"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:layout_marginLeft="4dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:padding="4dp"
            android:text="5th Sem"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.049"
            app:layout_constraintStart_toEndOf="@+id/tv_routine_semester_label"
            app:layout_constraintTop_toBottomOf="@+id/tv_routine_course" />

        <de.codecrafters.tableview.TableView
            android:id="@+id/tv_routine_table"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="70dp"
            android:background="#dfdfdf"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tv_routine_semester_label" />

    </android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>

</android.support.constraint.ConstraintLayout>

@ISchwarz23
Copy link
Owner

There is no way to make the table grow depending on it's content. It behaves the same as the ListView in Android.
To workaround would be, to set a fixed table height depending on the number of rows.

@yubarajoli77
Copy link
Author

Thanks for your response. Can we scroll the table view inside recyclerView then ? If, yes your help will be appreciated coz recyclerView stops me from scrolling the table.
Thanks in advance.

@ISchwarz23
Copy link
Owner

Hey, unfortunately the table view cannot change anything about it. You have to make the recycler view forward the scroll events. I don't know how this can be achieved and if this is possible. I also think that the user experience of such a layout will suffer.

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

2 participants