question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CollapsingToolbarLayout] Showing padding bottom in ImageView

See original GitHub issue

Description: When using android:fitsSystemWindows="true" and android:adjustViewBounds="true" together for ImageView in CollapsingToolbarLayout its give padding to ImageView at bottom

Expected behavior: Screenshot_1578649721

Current behavior: Screenshot_1578483416

Source code: `<?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android=“http://schemas.android.com/apk/res/android” xmlns:app=“http://schemas.android.com/apk/res-auto” xmlns:tools=“http://schemas.android.com/tools” android:layout_width=“match_parent” android:layout_height=“match_parent” android:fitsSystemWindows=“true”>

<androidx.core.widget.NestedScrollView
    android:id="@+id/nestedScrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <include
        android:id="@+id/include_bundle_detail_layout"
        layout="@layout/include_bundle_detail_layout" />

</androidx.core.widget.NestedScrollView>

<com.google.android.material.appbar.AppBarLayout
    android:id="@+id/appBarLayout"
    style="@style/Widget.Base.AppBarLayout"
    android:fitsSystemWindows="true">

    <com.google.android.material.appbar.CollapsingToolbarLayout
        android:id="@+id/collapsingToolbarLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimarySurface"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:titleEnabled="false">

        <ImageView
            android:id="@+id/imageView_bundleOfferImage"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            android:visibility="gone"
            app:layout_collapseMode="parallax"
            tools:ignore="ContentDescription"
            tools:src="@drawable/playstore_feature_graphic"
            tools:visibility="visible" />

        <View
            android:id="@+id/view_image_upper_gradient"
            android:layout_width="match_parent"
            android:layout_height="96dp"
            android:background="@drawable/gradient_black_transparent"
            android:visibility="gone"
            app:layout_collapseMode="pin"
            tools:visibility="visible" />

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/Widget.Base.Toolbar"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin" />

    </com.google.android.material.appbar.CollapsingToolbarLayout>

</com.google.android.material.appbar.AppBarLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout> ` Android API version: 29

Material Library version: 1.2.0-alpha03

Device: All emulator and real devices

Sample App: https://github.com/burhankhanzada199888/CollapsingToolbarLayoutWithImageBugSample

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mayuri-kulkarnicommented, Jun 2, 2021

+1

0reactions
droplet-jscommented, Jan 6, 2022

i have same issue with “com.google.android.material:material:1.4.0”

Read more comments on GitHub >

github_iconTop Results From Across the Web

CollapsingToolbarLayout Showing padding bottom in ...
to fix that you need to add android:fitsSystemWindows="true" from root to every child view until the view that you want to show below...
Read more >
CollapsingToolbarLayout - Android Developers
A full-bleed scrim which is show or hidden when the scroll position has hit a certain ... Sets the bottom expanded title margin...
Read more >
Collapsing Toolbar Layout | Android Studio 3.1.2 - YouTube
This video is about the collapsing toolbar layout, with an image view and a toolbar. Deploy NodeJs app: https://zeet.co/r/yourstruly(One ...
Read more >
Why fitsSystemWindows doesn't work sometimes? |
set RecyclerView paddingBottom = Navigation Bar height. so the navigation bar now: ... Movies demo app to show WindowInsets handling.
Read more >
Why Coordinatorlayout Leaves A Margin At The Bottom
Sometimes we need to detect weather a RecyclerView hits the bottom for alot of ... [CollapsingToolbarLayout] Showing padding bottom in ImageView #885.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found