How to check visibility of software keyboard in Android?

前端 未结 30 4426
半阙折子戏
半阙折子戏 2020-11-21 04:43

I need to do a very simple thing - find out if the software keyboard is shown. Is this possible in Android?

30条回答
  •  一生所求
    2020-11-21 05:21

    Checking the height of elements is not reliable because some keyboards like WifiKeyboard have zero height.

    Instead, you can use the callback result of showSoftInput() and hideSoftInput() to check for the status of the keyboard. Full details and example code at

    https://rogerkeays.com/how-to-check-if-the-software-keyboard-is-shown-in-android

提交回复
热议问题