CollapsingToolbarLayout有时在下面留下空白 [英] CollapsingToolbarLayout sometimes leaves white space below
本文介绍了CollapsingToolbarLayout有时在下面留下空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题。以下是截图:
I have a problem. Here are the screenshots:
这里是code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="256dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleMarginStart="64dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</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"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yo Yo" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabBtn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="@dimen/codelab_fab_margin_bottom"
android:layout_marginRight="@dimen/codelab_fab_margin_right"
app:borderWidth="0dp"
app:fabSize="normal" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:itemIconTint="@color/colorPrimaryDark"
app:itemTextColor="@color/colorPrimary"
app:menu="@menu/navigation_drawer_items" />
您可以有时会看到,一个白色的空间出现在工具栏下方,但有时没有。
窦哟有什么不对任何想法?因为我真的不知道如何解决这个问题。
You can see sometimes, a white space appears below the Toolbar, but sometimes no. Dou yo have any idea of what's wrong? Because I really don't know how to fix this.
由于提前,
编辑:我可以在Nexus的采用Android 5.1.1复制本7
推荐答案
作为<建议href=\"http://stackoverflow.com/questions/31271822/collapsingtoolbarlayout-doesnt-work-well-with-nestedscrollview\">this回答,试着加入:
android:layout_gravity="fill_vertical"
到 NestedScrollView
/ RecyclerView
。
这篇关于CollapsingToolbarLayout有时在下面留下空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文