我有一个片段内一个简单的折叠式工具,这是一个viewpager内侧tablayout:CollapsingToolbarLayout exitUntilCollapsed导致布局问题与NestedScrollView
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="192dp"
android:fitsSystemWindows="true"
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"
android:fitsSystemWindows="true"
app:expandedTitleMarginBottom="80dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:background="@color/red">
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
当我的片段首次加载这一切工作正常,但是当片段reshown交换标签后,我不能再滚动到NestedScrollView的最底部。我的内容的缺失部分与工具栏高度相同(更改工具栏高度会更改缺少的部分高度)。
这里的未涡卷视图:
当滚动至底部有未示出的部分,在该例子还有另一个“文本6”的TextView这就是关断屏幕,并且不能被访问。
在某些选项卡(我有6)我永远不能访问缺少的部分,对他人它遵循的模式:
- 可以滚动到下
- 更改选项卡,然后再返回因此该片段被杀死
- 不能滚动到底
- 更改多个标签
- 片段被重新充气选择选项卡时再次
- 能滚动到底
任何帮助,将不胜感激。
您是否试过将所有的适合系统Windows删除? – natario
另请参阅:在CTL上使用app:layout_scrollFlags =“scroll | enterAlways | enterAlwaysCollapsed | exitUntilCollapsed”,并删除工具栏上的滚动标志。 – natario
我玩过fitsSystemWindows是的,它需要设置为false,因为包含视图中的TabBarLayout的问题http://stackoverflow.com/questions/33100985/why-does-tablayout-leave-a-gap- for-the-navbar-when-in-immersive-mode – Leon