Search code examples
androidandroiddesignsupport

Android:Does the Recycler view works with Coordinator layout?


With reference to the new Android Design Support Library that is introduced; my question is:

Does the Recycler view works with Coordinator layout?
Because I am getting the scroll effects perfectly when working without the recycler view; but not working with it. So I just wish to know if anyone has worked on that.
I am trying something like that

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

                <include
                    android:id="@+id/app_bar_layout"
                    layout="@layout/my_toolbar" />

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/pmp_list"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@id/app_bar"
                    android:scrollbars="vertical"
                    app:layout_scrollFlags="scroll|enterAlways"
                    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

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

Solution

  • After wasting few hours I found that I was using older version of library:
    compile 'com.android.support:recyclerview-v7:21.0.+'
    Make sure you update it to latest:
    compile 'com.android.support:recyclerview-v7:22.2.0'
    Perhaps there was a bug which was fixed in newer version.
    Link below was quite helpful:
    http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/