[英]Android CollapsingToolbarLayout setLayoutFlags of views inside
I'm trying to make a CollapsingToolbarLayout
that is like GooglePlay . 我正在尝试制作类似于GooglePlay的CollapsingToolbarLayout
。
All is fine except for one thing. 除了一件事,一切都很好。
I can't make the toolbar
inside CollapsingToolbarLayout
to alwaysEnter
我无法将CollapsingToolbarLayout
的toolbar
为alwaysEnter
<android.support.design.widget.CollapsingToolbarLayout
android:elevation="2dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:contentScrim="@color/colorPrimaryDark"
android:id="@+id/toolbar_layout"
android:fitsSystemWindows="true"
app:titleEnabled="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
app:layout_collapseMode="parallax"
android:maxHeight="300dp"
android:id="@+id/profileFarmImage_loggedLO"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<android.support.v7.widget.Toolbar
app:layout_scrollFlags="scroll|enterAlways|snap"
android:layout_width="match_parent"
app:layout_collapseMode="pin"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
I know that setting scrollFlags
inside CollapsingToolbarLayout
won't have any effect, but if I set the scrollFlags
of my CollapsingToolbarLayout
as enterAlwaysCollapsed
I get unwanted behavior in which when the screen is scrolled to bottom and when I scrollup again all the views inside CollapsingToolbarLayout
is shown. 我知道在CollapsingToolbarLayout
中设置scrollFlags
不会产生任何效果,但是如果我将CollapsingToolbarLayout
的scrollFlags
设置为scrollFlags
, enterAlwaysCollapsed
不需要的行为,其中,当屏幕滚动到底部时,当我再次enterAlwaysCollapsed
滚动时,将显示CollapsingToolbarLayout
所有视图。 That's not the behavior I want. 那不是我想要的行为。
The behavior I want is when the screen is scrolled to bottom then when I scroll up I only want the toolbar
to show and when the screen is scrolled to top only then it will show the remaining view inside CollapsingToolbarLayout
. 我想要的行为是当屏幕滚动到底部时,而当我向上滚动时,我只希望显示toolbar
,而当屏幕滚动到顶部时,它将显示CollapsingToolbarLayout
的其余视图。
I know that this behavior is possible since GooglePlay implements it. 我知道这种行为是可能的,因为GooglePlay实现了它。
我可以通过设置CollapsingToolbarLayout
来修复它
android:minHeight="?attr/actionBarSize"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.