Skip to content

[BottomSheetDialogFragment] Gradient background #1841

Open
@CharlyLafon37

Description

Hello, I want to make a BottomSheetDialogFragment with a gradient background.

I've managed to change the background color of the dialog with these styles :

<style name="RoundedBottomSheetDialogTheme" parent="@style/ThemeOverlay.MaterialComponents.Light.BottomSheetDialog">
    <item name="bottomSheetStyle">@style/RoundedBottomSheetStyle</item>
    <item name="android:windowIsFloating">false</item>
</style>

<style name="RoundedBottomSheetStyle" parent="@style/Widget.MaterialComponents.BottomSheet.Modal">
    <item name="shapeAppearanceOverlay">@style/RoundedBottomSheetDialogShape</item>
    <item name="backgroundTint">@color/colorPrimary</item>
</style>

<style name="RoundedBottomSheetDialogShape" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSizeTopRight">16dp</item>
    <item name="cornerSizeTopLeft">16dp</item>
    <item name="cornerSizeBottomRight">0dp</item>
    <item name="cornerSizeBottomLeft">0dp</item>
</style>

But backgroundTint only supports plain colors, not gradients.

Is it possible with the latest version of the library to achieve a gradient background ?

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions