How do I detect if software keyboard is visible on Android Device or not?

前端 未结 30 1353
情书的邮戳
情书的邮戳 2020-11-22 10:59

Is there a way in Android to detect if the software (a.k.a. \"soft\") keyboard is visible on screen?

30条回答
  •  隐瞒了意图╮
    2020-11-22 11:47

    You can refer to this answer - https://stackoverflow.com/a/24105062/3629912

    It worked for me everytime.

    adb shell dumpsys window InputMethod | grep "mHasSurface"
    

    It will return true, if software keyboard is visible.

提交回复
热议问题