【问题标题】:space between nested scrollview and collapsing toolbar android嵌套滚动视图和折叠工具栏android之间的空间
【发布时间】: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


【解决方案1】:

我通过将android:layout_gravity="fill_vertical" 添加到 NestedScrollView 解决了这个问题。

同样的问题在这里CollapsingToolbarLayout sometimes leaves white space below

而且设计库似乎还有点小问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多