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

[Snackbar] Override Default Snackbar animation

Open
#2,030 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Widget: Snackbar
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Limited snackbar animations - Slide or Fade

**Describe the solution you'd like**
I would like to use a custom animation through theme, xml or `setAnimation`

**Describe alternatives you've considered**
Currently I need to create a whole Snackbar class to override it or use it through custom views and visibilty handling of the default animation

Current `animateView` is fixed to one of these two options. I would like to add my custom animation somehow:

```
void animateViewIn() {
// Post to make sure animation doesn't start until after all inset handling has completed
view.post(
new Runnable() {
@Override
public void run() {
if (view == null) {
return;
}
// Make view VISIBLE now that we are about to start the enter animation
view.setVisibility(View.VISIBLE);
if (view.getAnimationMode() == ANIMATION_MODE_FADE) {
startFadeInAnimation();
} else {
startSlideInAnimation();
}
}
});
}
```

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.

Research direction

Start with Snackbar's animateViewIn(), startFadeInAnimation(), and startSlideInAnimation() entry points shown in the issue. Clarify how a custom animation should be supplied through theme, XML, or setAnimation, and define completion as using that animation without replacing Snackbar or manually managing visibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.