1

I'm having some issues implementing a CollapsingToolbarLayout in my app in conjunction with a recyclerview. So I have it all setup and working (compared to a few different sources - including the CheeseSquare setup) - but I'm having some issues with spacing near the bottom of the layout (1st photo & 3rd photo) I was hoping someone might be able to help with.

Images found here: https://i.stack.imgur.com/I6naM.jpg

It seems a few others have had this problem, and their answers did not solve mine - completely atleast:

CoordinatorLayout leaves empty space at the bottom after scrolling

Whitespace below CoordinatorLayout in DrawerLayout

I tried adding the android:layout_gravity="fill_vertical" to the NestedScrollView / Recyclerview as suggested, and while that seems to (mostly) fix it, it now hides about 1 & 1/3 of the lowest views (looking at the views through the hierarchy viewer - Photo 4). I'm sure there's a solution to this, but I haven't been able to figure it out yet. Any assistance would be much appreciated.

Activity Layout file:

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/coordinator_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="240dp"
        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:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleTextAppearance="@style/GasMonitorTheme.ActionBar.TitleTextAppearance"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:id="@+id/toolbar_imageview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                android:transitionName="car_image"
                app:layout_collapseMode="parallax"
                />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar_actionbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
        android:layout_gravity="fill_vertical"
        android:id="@+id/fragment_recyclerview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/default_side_padding"
        android:clickable="true"
        android:src="@drawable/ic_add"
        android:tint="@color/white"
        app:layout_anchor="@id/coordinator_layout"
        app:layout_anchorGravity="bottom|right|end"
        />
</android.support.design.widget.CoordinatorLayout>

I've gone through and simplified my activity to match that of the CheeseSquare app (trying to find why only mine is doing this), aside from my adapter pulling from a List. I've tested this and seen the same issue on API 22 & 23.

Community
  • 1
  • 1
Logan
  • 1,376
  • 1
  • 8
  • 10
  • post ur xml files of the layout – Aman Verma Feb 06 '16 at 17:59
  • They're included above in the pastebin link, but I'll put them inline as well. – Logan Feb 06 '16 at 18:02
  • Check this link: http://stackoverflow.com/a/31266160/4409113 - It's Design Library's fault. – ʍѳђઽ૯ท Feb 06 '16 at 18:07
  • I saw that link in my research into this issue as well, and I'm sure it has something to do with the Design Library, but the recyclerview I have has 20-40 entries in it (while I was doing the testing) - so there's no shortage of content. It doesn't do this every time either - it will cycle between working fine, and having that spacing issue at the bottom. No difference in configuration between events. Just opening / closing the activity switches between them. – Logan Feb 06 '16 at 18:12

0 Answers0