Skip to content

[BottomSheetDialog] layout_margin - sheet moves to set margin value when anything in it is interacted with - 1.5.0 and 1.6.0-alpha03 #2589

Open
@durkester

Description

The bottomsheet has a top margin of 25dp. When an item is added to the recyclerview within, the bottomsheet jumps down 25dp once. So if the bottom sheet starts GONE, an item is added, it's set to 120dp peekheight. That works fine.

But when any more items are added the sheet jumps back to 95dp (120-25) height. If you drag the sheet up and back down it rests at 120 as it should. But it will jump back to 95 if another item is added. This happens if any of the margin options that include the top (layout_margin, layout_margin_vertical)

It works fine with no margin set.

Device: emulator, and real phone Fold 2.

API: 30

tried on 1.5.0 and 1.6.0 alpha3

XML::

<data>
    <variable
        name="..."
        type="..." />
</data>

<FrameLayout
    android:id="@+id/top_frame_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="0dp"
        map:uiCompass="true"
        map:uiMapToolbar="true"
        map:uiZoomControls="true"
        tools:context=".MapsActivity"
        tools:layout="@layout/support_simple_spinner_dropdown_item"
        tools:visibility="gone" />

    <androidx.constraintlayout.widget.ConstraintLayout

    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:visibility="invisible">

        <FrameLayout
            android:id="@+id/standard_bottom_sheet"
            style="@style/ModalBottomSheetDialog"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="25dp"
            map:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

            <!-- Bottom sheet contents. -->

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:visibility="visible">

                <com.google.android.material.chip.Chip ...

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recycler_view"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    map:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    map:layout_constraintBottom_toBottomOf="parent"
                    map:layout_constraintEnd_toEndOf="parent"
                    map:layout_constraintStart_toStartOf="parent"
                    map:layout_constraintTop_toBottomOf="@id/bottom_sheet_chip" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </FrameLayout>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:alpha="0"
        android:background="#FFFFFF">

    </Toolbar>

</FrameLayout>

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions