本文介绍了与CollapsingToolbarLayout一起使用时,NestedScrollView不会滚动到末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将NestedScrollView与CollapsingToolbarLayout一起使用.在NestedScrollView中,内容确实很长.不幸的是,我无法滚动到最后.一些长篇幅的内容被删减了.当我打开屏幕,滚动正常且所有内容可见时,这很奇怪.
I want to use NestedScrollView with CollapsingToolbarLayout. In NestedScrollView there is really long content. Unfortunately I can't scroll to the end. Some of this long content is cut. What is strange when I turn screen, scrolling works fine and all content is visible.
<android.support.design.widget.CoordinatorLayout
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.design.widget.AppBarLayout
android:fitsSystemWindows="true"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<android.support.design.widget.CollapsingToolbarLayout
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:fitsSystemWindows="true"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/u8"
app:layout_collapseMode="parallax"/>
<android.support.v7.widget.Toolbar
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:clipToPadding="false"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<!-- lots of widgets-->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
我注意到剪切内容的高度与工具栏的高度相同.
I noticed that height of cut content is the same as Toolbar height.
推荐答案
答案来自.将paddingBottom添加到NestedScrollView为我解决了此问题:
Answer taken from here. Adding paddingBottom to NestedScrollView resolved this issue for me:
android:paddingBottom="<toolbar height in collapsed state>"
这篇关于与CollapsingToolbarLayout一起使用时,NestedScrollView不会滚动到末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!