# Animating your keyboard: Reacting to inset animations

DevFeed: [Animating your keyboard: Reacting to inset animations](<https://devfeed.tech/articles/animating-your-keyboard-reacting-to-inset-animations-24921.md>)

Original publisher: [Read original article](<https://medium.com/androiddevelopers/animating-your-keyboard-reacting-to-inset-animations-839be3d4c31b?source=rss-9303277cb6db------2>)

Author: Chris Banes

Published: 2020-08-24T18:46:01Z

Content type: tutorial

Language: en

Sources: [Chris Banes on Medium](<https://devfeed.tech/sources/chris-banes-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [API](<https://devfeed.tech/topics/api.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [11weeksofandroid](<https://devfeed.tech/tags/11weeksofandroid.md>), [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [animation](<https://devfeed.tech/tags/animation.md>), [api](<https://devfeed.tech/tags/api.md>), [keyboard](<https://devfeed.tech/tags/keyboard.md>)

## AI overview

This tutorial explains how to create smoother keyboard animations in Android 11 using the WindowInsetsAnimation and WindowInsetsAnimation.Callback APIs. It contrasts the seamless movement available on Android 11 with the state-snapping behavior on Android 10 and earlier, then walks through implementing the callback and updating a view during the animation.

## Source excerpt

Illustration by Kiran PuriAnimating your keyboard (part 2): reacting to WindowInset animationsCreating seamless keyboard animations using WindowInsetAnimation In the previous blog post, we covered all of the changes to the APIs related to going edge-to-edge: Animating your Keyboard In this blog post we move forward on with the actual task of animating the keyboard. To demonstrate what is possible, here you can see an example of the same app, running on Android 10 on the left, and Android 11 on the right (at 20% speed): On devices running Android 10 and before, when the user clicks on the text input to type a reply, the keyboard animates into place, but the app snaps between the states. This is the behaviour you've seen on your devices for a while, it's just easier to see at 20% speed. On the right you can see the same scenario running on Android 11. This time when the user clicks on the text input, the app moves with the keyboard, creating a more seamless experience. So how can you add this experience to your app? Well it's all powered by some new APIs... WindowInsetsAnimation The API which powers this in Android 11 is the new WindowInsetsAnimation class, which encapsulates an animation involving insets. Apps can listen to animation events through the WindowInsetsAnimation.Callback class, which can be set on a view: https://medium.com/media/5b45d5c8a5e3c6fe2ad82d212d56713e/href So let's just a look at the callback class, and the functions it provides: Imagine that the keyboard is currently closed, and the user has just clicked on an EditText. The system is now about to start showing the keyboard, and since we have a WindowInsetsAnimation.Callback set, we'll receive the following calls in order: https://medium.com/media/8d0b05394ee10940a70775bc554ab192/href So that's how the callback works in theory, now let's apply it to a scenario... Implementing the example We're going to use WindowInsetsAnimation.Callback to implement the example which you saw at the beginning of thi