【发布时间】:2016-05-30 18:10:25
【问题描述】:
直升机,
我正在为一个网站开发应用程序。我遇到了折叠工具栏和嵌套 ScrollView 的问题。
第一次打开文章时,它看起来像这样 (http://imgur.com/UpIJa59)。向下滚动后,文本和图像之间的空白将被删除。
这是我的活动布局:
<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.ArticleToolbar">
<android.support.design.widget.AppBarLayout
android:layout_height="192dp"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/appbar_article">
<android.support.design.widget.CollapsingToolbarLayout
android:fitsSystemWindows="true"
android:id="@+id/collapsing_toolbar"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="4dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:id="@+id/head_image"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/article_header"
android:textSize="23sp"
android:gravity="bottom" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_height="?attr/actionBarSize"
android:id="@+id/toolbar_article"
android:layout_width="match_parent"
app:popupTheme="@style/AppTheme"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container_article"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/appbar_article"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
你有什么建议? 谢谢。
【问题讨论】:
-
可能是这个问题 android:fitsSystemWindows="true" 尝试删除它
-
@user2217535 只是尝试这样做。不幸的是,它没有帮助
标签: java android android-layout