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

MenuItem icon not animating...

Open
#2,620 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Component used: Navigation
Version used: SDK31
Devices/Android versions reproduced on: Pixel 4

I have created an ic_animation.xml as described at https://developer.android.com/guide/topics/graphics/drawable-animation that I set on a MenuItem's icon in activity_main_drawer.xml. Indeed when I inspect the MenuItem in the debugger the icon is of type AnimationDrawable. I add a DrawerListener in MainActivity and in the onDrawerOpened I tell the animation to start(). The isRunning() value changes from False to True but the animation doesn't actually run. Please see the attached example project built from the Navigation Drawer Activity for an example.

[MyApplication.zip](https://github.com/material-components/material-components-android/files/8365011/MyApplication.zip)

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 the attached example project, especially activity_main_drawer.xml and MainActivity's DrawerListener. Reproduce the issue on SDK31 with the Navigation component and a Pixel 4 or equivalent, then trace why the AnimationDrawable reports running without visibly animating. Done means the MenuItem icon visibly animates when the drawer opens.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.