Recyclerview Log Statement: W/recyclerview: Recyclerview Does Not Support Scrolling To An Absolute Position. Use Scrolltoposition Instead
Solution 1:
I'm seeing exactly the same thing and in my case it's caused by the XML attribute
android:animateLayoutChanges="true"
on the RecyclerView's parent - or programmatically setting a LayoutTransition on the parent view, that does the same thing. See this answer on a different SO question. (It looks like it used to be an exception rather than a log in older Android versions, we're lucky in that regard.)
Removing the attribute fixes it, obviously. If (like me) you want to keep it, try organizing your view in such a way that the direct parent of the RecyclerView does not have it, like Sniper suggests in the post I linked to. Copying his example here in case it gets deleted:
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/top_parent_view"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><FrameLayoutandroid:id="@+id/header_view"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"android:clickable="true"android:animateLayoutChanges="true"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"/><ImageViewandroid:id="@+id/header_arrow_icon"android:layout_width="24dp"android:layout_height="24dp"android:layout_gravity="end|center_vertical"/></FrameLayout><android.support.v7.widget.RecyclerViewandroid:id="@+id/recycler_view"android:layout_width="match_parent"android:layout_height="match_parent"/>
If (like me) you need the LayoutTransition animation on the RecyclerView, putting a wrapper view between the RecyclerView and the view with the layout animations is enough to get rid of the warnings:
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:animateLayoutChanges="true"android:layout_width="match_parent"android:layout_height="match_parent"><FrameLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><android.support.v7.widget.RecyclerViewandroid:layout_width="match_parent"android:layout_height="wrap_content"/></FrameLayout></LinearLayout>
Basically make sure the android:animateLayoutChanges property is not on the RecyclerView's parent.
The actual layout change animation works fine even with the warnings, though. I don't know if the performance impact of adding a layer to your view hierarchy is worth it. A better solution might be to subclass the RecyclerView and override the scrollTo (x, y) method to not print the log, like another answer on the same SO question.
Solution 2:
Put this line in Adapter constructor, maybe it'll work for you:
this.setHasStableIds(true);
Post a Comment for "Recyclerview Log Statement: W/recyclerview: Recyclerview Does Not Support Scrolling To An Absolute Position. Use Scrolltoposition Instead"