【发布时间】:2016-03-22 06:24:19
【问题描述】:
我想将 NestedScrollView 与 CollapsingToolbarLayout 一起使用。在 NestedScrollView 中有很长的内容。不幸的是,我无法滚动到最后。其中一些长内容被剪掉了。当我转动屏幕时奇怪的是,滚动工作正常并且所有内容都可见。
<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>
编辑:我注意到剪切内容的高度与工具栏高度相同。
【问题讨论】:
-
如果将 LinearLayout 的高度设置为
wrap_content会发生什么?通常,滚动小部件内的任何布局都会在滚动方向上获得wrap_content。 -
什么都没有。仍然无法滚动到最后。
-
这里有同样的问题。我尝试在某些地方添加 android:fitsSystemWindows="true" 以及 android:windowSoftInputMode="adjustResize" 到清单。到目前为止,所有想法都失败了。
-
你找到解决办法了吗?
-
嘿伙计!你找到解决办法了吗?
标签: android layout android-collapsingtoolbarlayout android-appbarlayout nestedscrollview