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.

Child view is cut off when `expandedOffset` is set on BottomSheetBehavior

See original GitHub issue

Description:

When I add a RecyclerView to that FragmentContainerView, the bottom of it is cut off (doesn’t let me scroll to the end) by the same amount as I set as the behavior_expandedOffset.

Expected behavior:

I would expect all content to be scrollable.

Source code:

    <androidx.constraintlayout.widget.ConstraintLayout
        style="@style/ONX.Widget.BottomSheet.Light"
        android:id="@+id/query_bottomsheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

        <com.onxmaps.onxmaps.customviews.bottomsheetheader.BottomSheetHeader
            android:id="@+id/map_query_header"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>

        <androidx.fragment.app.FragmentContainerView
            android:id="@+id/map_query_container"
            android:name="com.onxmaps.onxmaps.bottomsheet.BottomSheetLoadingFragment"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintTop_toBottomOf="@id/map_query_header"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"/>

    </androidx.constraintlayout.widget.ConstraintLayout>

with the following style:

    <style name="ONX.Widget.BottomSheet" parent="Widget.MaterialComponents.BottomSheet">
        <item name="android:paddingTop">@dimen/bottomsheet_padding_top</item>
        <item name="behavior_halfExpandedRatio">@dimen/bottomsheet_halfratio</item>
        <item name="behavior_fitToContents">false</item>
        <item name="behavior_hideable">true</item>
        <item name="shapeAppearance">@null</item>
        <item name="behavior_expandedOffset">150</item>

Android API version: 28

Material Library version: Material Android Library version you are using here (e.g., 1.1.0-alpha07)

implementation 'com.google.android.material:material:1.1.0'

implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'

implementation 'androidx.appcompat:appcompat:1.0.2'

I also tried material:1.2.0-alpha06 and constraintlayout:2.0.0-beta5

Device: Samsung Galaxy S8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
TakeoffAndroidcommented, Jan 10, 2021

I was facing the same issue, and I replaced ConstraintLayout to LinearLayout… Magically everything starts working… I know it is super weird, but this is the only fix which resolved the issue…

2reactions
guilucas07commented, Feb 27, 2021

same as @TakeoffAndroid, replace constraintLayout to LinearLayout “solved” the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set expanded height (or min top offset) - Stack Overflow
I fixed it so that the parent view of the bottom sheet is colored. ... turn fitToContents off and set expandedOffset to desired...
Read more >
BottomSheetBehavior setState method doesn't work before ...
Slide the bottomsheet down. 6. Click in the "Show view" button. Now the bottomsheet expands correctly.
Read more >
Sheets: bottom - Material Design
BottomSheetBehavior is applied to a child of CoordinatorLayout to make that child a persistent bottom sheet, which is a view that comes up...
Read more >
Hands-on with Material Components for Android: Bottom Sheets
A child View of a CoordinatorLayout can have Standard Bottom Sheet characteristics enabled by using BottomSheetBehavior .
Read more >
Android cc模块,Android模块化和可定制的 Material Design UI ...
Sets default for BottomSheetBehavior paddingTopSystemWindowInsets to true ... Fixed scrolling sibling view bottom cut off issue (a21a300).
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