Determining Keyboard Visibility Using SetOnApplyWindowInsetsListener

Nathan Sokalski 4,111 Reputation points
2022-07-29T02:23:12.407+00:00

I have several elements which I need to modify when the keyboard is shown or hidden. If I understand correctly, this can be done in Android 11 using SetOnApplyWindowInsetsListener. However, I am having trouble figuring out how to do this (and none of the examples are in Xamarin.Android / C#). I have looked at the following sites:

https://proandroiddev.com/exploring-windowinsets-on-android-11-a80cf8fe19be
https://proandroiddev.com/android-11-creating-an-ime-keyboard-visibility-listener-c390a40d1ad0
https://developer.android.com/reference/android/view/View.html#setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener)

How exactly do I create the IOnApplyWindowInsetsListener? Are there any good tutorials or examples of this in C# for Xamarin.Android? Thanks.

Developer technologies .NET Xamarin
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.