Forum Xamarin.Android

How to detect if the soft-keyboard is dismissed in adjustPan configuration (ONLY) in Android?

FedericoNavarreteFedericoNavarrete SVMember ✭✭✭
edited December 2018 in Xamarin.Android

Fellow Developers, I'm having a challenge that I cannot figure out how to fix and I'm aware that there are thousands of possible questions or hacks connected to my one:

However, almost all of them are connected to check the size of the screen and I can explain the context of my question of why I would like to find a solution.

I have been developing a hybrid app for a while and I have only a minor issue that is this one:


The last row unfortunately in some devices is partially visible and I know what code I should add in jQuery in order to display it properly:

    $("#divCustomTime").css({top: -200, position:'absolute'});

However, if the keyboard is dismissed in a different way that is not pressing enter, the location of the div is impossible to relocate to its previous location and I cannot find any way of how to hack it or tricky it, I tried different approaches in order to detect the dismissing event such as:

  • Pressing back button (not triggered at all).
  • Thread for detecting isAcceptingText. It didn't work at all. An example of one of the codes that I tried in C#:

    public void KeyboardStatus()
        var timer = new System.Threading.Timer(callback, (InputMethodManager)context.GetSystemService(Context.InputMethodService), TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
    private static void callback(object state)
        if ((InputMethodManager)state.IsAcceptingText) {
        } else {
            //never happens

Where did I get this idea?

You might ask, why don't you use the option of adjustResize?

It'd be easier to detect and I know, however, the entire app is misconfigured and distorted, up to a point that I should involve a lot of CSS and JS in order to more or less configure it to don't look so terrible, that's why I chose the option of pan and not resize.

Does anyone have any idea how to detect it? Thanks.


Sign In or Register to comment.