问题描述
我正在将collapsingToolbarlayout
与nestedscrollview
一起使用,并且可以正常工作,直到collapsingToolbarlayout
完全折叠并显示actionbar
为止. nestedscrollview
在这里停止滚动,并且某些项目仍处于隐藏状态.
I am using collapsingToolbarlayout
with nestedscrollview
and it works fine, until the collapsingToolbarlayout
is completely collapse and actionbar
is showing. Here the nestedscrollview
stop scrolling and some items still hidden.
这是我的xml文件
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
>
<FrameLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
>
<ImageView
android:id="@+id/BigThumbnailImage"
android:layout_width="match_parent"
android:layout_height="200dp"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:src="@drawable/bg_health_news"
android:scaleType="fitXY" />
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
>
<include
android:layout_width="match_parent"
android:layout_height="0dp"
layout="@layout/place_item_details_views"
android:layout_weight="1"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
我搜索了很多&我不知道为什么会发生
I have searched a lot & I don't know why it happens
预先感谢
更新
我发现问题是我包含一个包含horizontalscrollview
的布局,当它为空或包含数据时,如果有人知道此问题可以帮助我,就会导致此问题
I have find out the problem is I am including a layout that contains a horizontalscrollview
and when it empty or contains data it causes this issue if someone knows this problem can help me thanks
推荐答案
我认为原因是由于班次的原因,您的最后一个项目不在屏幕上,因此您可以尝试添加:
I think the reason is that your last items are out of the screen, because of shift, so you can try to add:
android:paddingBottom="<your toolbar height in collapsed state>"
到您的NestedScrollView.就我而言,这很有帮助.
to your NestedScrollView. In my case that helped.
这篇关于当CollapsingToolbarLayout完全折叠时,为什么NestedScrollView停止滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!