Skip to content

MaterialButton android:foreground doesn't work on BottomSheetDialogFragment #2999

@slm

Description

@slm

Description:
MaterialButton android:foreground attribute doesn't work inside of a BottomSheetDialogFragment. But It works as expected in Fragment.

Expected behavior:
The foreground of MaterialButton should be shown inside of the BottomSheetDialogFragment.

material button inside of the Fragment

Screenshot 2022-09-27 at 17 52 28

material button inside of BottomSheetDialogFragment.

Screenshot 2022-09-27 at 17 52 44

Source code: The code snippet which is causing this issue

        <com.google.android.material.button.MaterialButton
            android:id="@+id/editButton"
            style="@style/AppTheme.Button.BottomActionButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/d1"
            android:foreground="@drawable/ic_arrow_drop_down_24dp"
            android:gravity="center_vertical|center_horizontal"
            android:text="@string/close_app"
            android:textColor="@color/white" />

Minimal sample app repro:

Android API version: Android API version here

Material Library version: 1.5.0, 1.8.0-alpha01

Device: Emulator API 31

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions