Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

space between nested scrollview and collapsing toolbar android

Helo,

I am working on app for one website. I have an issue with collapsing toolbar and Nested ScrollView.

It looks like this (http://imgur.com/UpIJa59) when you open up the article for the first time. After scrolling down white space between text and image removes.

Here is my layout for this activity:

<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"/>

What can you suggest? Thank you.

like image 666
awave Avatar asked Feb 09 '23 14:02

awave


1 Answers

I solved this issue by adding android:layout_gravity="fill_vertical" to NestedScrollView.

Same issue was here CollapsingToolbarLayout sometimes leaves white space below

And it also seems that Design library still little buggy.

like image 120
awave Avatar answered Feb 12 '23 07:02

awave