Hi guys, quick question.
I've just finished implementing RecyclerView on my project after an awful struggle - despite updating the Adapter dataset, the view won't update. I've tried doing it in multiple ways - deleting all existing elements and adding the entire list, creating a new ArrayList, creating a new Adapter... nothing worked.
In the end, the problem turned out to be making the RecyclerView wrap its content. I didn't understand how it can cause such a bug so I dug a bit online and all I could find is that it was a bug that was fixed roughly 2 years ago in version 23.2.1.
So I wonder if the problem is somehow in my XML file? I'd just like to know what caused this bug since I've spent so much time on practically nothing, it would be nice to actually take something from it...
I've just finished implementing RecyclerView on my project after an awful struggle - despite updating the Adapter dataset, the view won't update. I've tried doing it in multiple ways - deleting all existing elements and adding the entire list, creating a new ArrayList, creating a new Adapter... nothing worked.
In the end, the problem turned out to be making the RecyclerView wrap its content. I didn't understand how it can cause such a bug so I dug a bit online and all I could find is that it was a bug that was fixed roughly 2 years ago in version 23.2.1.
So I wonder if the problem is somehow in my XML file? I'd just like to know what caused this bug since I've spent so much time on practically nothing, it would be nice to actually take something from it...
Code:
<?xml version="1.0" encoding="utf-8"?>
<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:fitsSystemWindows="true"
android:background="@color/colorBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/dateHeadline"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorPrimary"
android:textColor="@color/headlineTextColor"
android:gravity="center"
android:textStyle="bold"
android:textSize="18sp" />
<android.support.v7.widget.RecyclerView
android:id = "@+id/eventsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabulousFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginBottom="16dp"
android:layout_marginEnd="24dp"
android:src="@android:drawable/ic_input_add"
android:tint="@android:color/background_light"
app:backgroundTint="@android:color/background_dark"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>