我有一个CollapsingToolbarLayout和一个viewflipper来自动更改图像。我的问题是当用户向上滚动或折叠后,我的应用栏显示Viewflipper图像,我不想这样做我希望我的工具栏必须得到原始颜色一旦它崩溃This is what i am getting,second image once it is collapsed
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="250dp"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<ViewFlipper
android:id="@+id/srinivasflipper"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ViewFlipper>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
尝试在viewfliper中添加app:layout_collapseMode="parallax"
,它是所需效果所必需的。
您可以使用app:layout_collapseMode =“parallax”(以及可选的app:layout_collapseParallaxMultiplier =“0.7”来设置视差乘数)来实现视差滚动(比如CollapsingToolbarLayout中的兄弟ImageView)。此用例与CollapsingToolbarLayout的app:contentScrim =“?attr / colorPrimary”属性很好地配对,在折叠视图时添加完整的出血稀松布。
注意 :
此外,由于折叠工具栏扩展了framelayout,您需要将工具栏放在viewflipper下面。