material-components / material-components/material-components-android

[BottomSheetDialogFragment] Gradient background

Open
#1,841 4 comments 0 reactions 1 assignee View on GitHub

@hunterstich is already working on this.

Since Feb 10, 2025.

Awaiting Design Feedback bug Widget: BottomSheet
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

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 ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.