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

[Snackbar] Snackbar flickers and ignores `gestureInsetBottomIgnored = false` when `anchorViewLayoutListenerEnabled = true`

Open
#4,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**Description:**

https://github.com/user-attachments/assets/aba1672c-4bad-412f-9b4d-0b69870ec653

**Source code:**

```java
// ...

View anchorView = view.findViewById(R.id.anchor_view);
ValueAnimator animation = ValueAnimator.ofInt(100, -400);
animation.setDuration(3000);
animation.setRepeatMode(Animation.REVERSE);
animation.setRepeatCount(Animation.INFINITE);
animation.addUpdateListener(updatedAnimation -> {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) anchorView.getLayoutParams();
params.setMargins(0, 0, 0, (int) updatedAnimation.getAnimatedValue());
anchorView.setLayoutParams(params);
});
animation.start();

Snackbar snackbar = Snackbar.make(view, "Test snackbar", Snackbar.LENGTH_INDEFINITE);
snackbar.setAnchorView(anchorView);
snackbar.setAnchorViewLayoutListenerEnabled(true);
snackbar.setGestureInsetBottomIgnored(false);
snackbar.show();

// ...
```

```xml

```

**Device:** Pixel 4a (5G)

**Android API version:** 34

**Material Library version:** 1.13.0-alpha06

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 by reproducing the issue with the provided Java and XML example on Android API 34, focusing on Snackbar anchor layout updates and gesture inset handling. Done means the Snackbar no longer flickers while the anchor moves and gestureInsetBottomIgnored=false is respected when anchorViewLayoutListenerEnabled=true.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.