我在CoordinatorLayout
家长内使用AppBarLayout
,CollapsingToolbarLayout
,ViewPager
,RelativeLayout
。
在滚动列表ViewPager (include recyclerview inside fragment)
之前,滚动CollapsingToolbarLayout
正常工作。但是,当我第一次滚动ViewPager
时,再次滚动CollapsingToolbarLayout
无效。!!为什么呢?
我想在viewpager上滚动并在CollapsingToolbarLayout上滚动。 CollapsingToolbarLayout不可滚动:|
我的XML布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true">
<ImageView
android:id="@+id/BgPhoto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:scaleType="centerCrop" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="60dp"
android:background="@color/trans10"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="@android:color/transparent"
app:titleEnabled="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:orientation="vertical"
app:layout_collapseMode="none">
<!-- date and rate -->
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingBottom="20dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:weightSum="3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="12sp"
android:gravity="left"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="12sp"
android:gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="12sp"
android:gravity="right"/>
</LinearLayout>
<com.facebook.drawee.view.SimpleDraweeView
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:id="@+id/circlePhoto"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
fresco:fadeDuration="200"
fresco:actualImageScaleType="centerCrop"
fresco:roundingBorderWidth="1dp"
fresco:roundAsCircle="true"/>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
app:tabTextAppearance="?android:attr/textAppearanceSmall"
app:tabTextColor="@color/trans11"
app:tabSelectedTextColor="@color/white"
app:tabMode="fixed"
app:tabIndicatorHeight="2dp"
app:tabIndicatorColor="@color/white" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout> </RelativeLayout>