My CollapsingToolbarLayout doesn't work with RecyclerView if that RecyclerView's ViewHolder contains another horizontal RecyclerView. Anyone can help me?First thank you all. My main Xml is:
<?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:id="@+id/circlebd_rootview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="256dip"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/header"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.4" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/circleinfo_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/recyclerbg"
android:fillViewport="true"
android:layout_marginBottom="?attr/actionBarSize"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/></android.support.design.widget.CoordinatorLayout>
And this is my ViewHodler:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dip"
android:background="@color/gray_light"
android:paddingBottom="1dp">
<RelativeLayout
android:id="@id/con_item_r1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/contentitem_top"
android:paddingBottom="10dip">
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@id/con_item_recyclerview"
android:layout_width="match_parent"
android:layout_height="@dimen/showimg_height"
android:layout_below="@id/con_item_r1"/>
The ViewHolder's RecyclerView is horizontal.And main activity's RecyclerView is vertical. If I change ViewHolder's RecyclerView to View,CollapsingToolbarLayout is OK. My question is how can I use ViewHolder's RecyclerView and also let the CollapsingToolbarLayout work.